diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-08-27 09:06:07 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-08-27 09:06:07 +0000 |
commit | ca3ff4f6a27ff2d421a7f8fdd3bd5dd67f1f47df (patch) | |
tree | ff49b955d8377c841b181ca599ff16d52e421eda /audio/headset.c | |
parent | 59badd8391ce0bcd940abed5a750e0192eef9ed8 (diff) |
Fix headset state change when an error occurs on both the SCO and the RFCOMM fd's in the same mainloop iteration
Diffstat (limited to 'audio/headset.c')
-rw-r--r-- | audio/headset.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/headset.c b/audio/headset.c index 056f9e18..5c758db0 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -86,6 +86,7 @@ struct headset { GIOChannel *rfcomm; GIOChannel *sco; + guint sco_id; guint ring_timer; @@ -188,6 +189,8 @@ static void close_sco(struct device *device) struct headset *hs = device->headset; if (hs->sco) { + g_source_remove(hs->sco_id); + hs->sco_id = 0; g_io_channel_close(hs->sco); g_io_channel_unref(hs->sco); hs->sco = NULL; @@ -1523,8 +1526,9 @@ void headset_set_state(struct device *dev, headset_state_t state) case HEADSET_STATE_PLAY_IN_PROGRESS: break; case HEADSET_STATE_PLAYING: - g_io_add_watch(hs->sco, G_IO_ERR | G_IO_HUP | G_IO_NVAL, - (GIOFunc) sco_cb, dev); + hs->sco_id = g_io_add_watch(hs->sco, + G_IO_ERR | G_IO_HUP | G_IO_NVAL, + (GIOFunc) sco_cb, dev); dbus_connection_emit_signal(dev->conn, dev->path, AUDIO_HEADSET_INTERFACE, |