diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-11-25 16:11:24 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-11-25 16:11:24 -0300 |
commit | c6ca785eb241e6e93bcc6ef1ef430cf09ae362b3 (patch) | |
tree | 666c45cfd8e2ad75aa1309e26242b3163f9fcd6e /audio/headset.c | |
parent | c3a264a57a6e61c22280b52dd01f2677600a04f2 (diff) |
Make hfp/hsp to suspend properly.
Diffstat (limited to 'audio/headset.c')
-rw-r--r-- | audio/headset.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c index 75affd37..27580c5d 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -2144,6 +2144,37 @@ unsigned int headset_request_stream(struct audio_device *dev, return id; } +unsigned int headset_suspend_stream(struct audio_device *dev, + headset_stream_cb_t cb, + headset_lock_t lock, + void *user_data) +{ + struct headset *hs = dev->headset; + unsigned int id; + + if (hs->lock & ~lock) + return 0; + + if (!hs->rfcomm) + return 0; + + if (hs->dc_timer) { + g_source_remove(hs->dc_timer); + hs->dc_timer = 0; + } + + if (hs->state == HEADSET_STATE_CONNECT_IN_PROGRESS || + hs->state == HEADSET_STATE_PLAY_IN_PROGRESS) + return connect_cb_new(hs, HEADSET_STATE_CONNECTED, cb, + user_data); + + close_sco(dev); + id = connect_cb_new(hs, HEADSET_STATE_CONNECTED, cb, user_data); + g_idle_add((GSourceFunc) dummy_connect_complete, dev); + + return id; +} + gboolean get_hfp_active(struct audio_device *dev) { struct headset *hs = dev->headset; |