Fix not waiting for POLLERR when disconnecting SCO
Luiz Augusto von Dentz
maintainerPATCH v2 1/1 Fix not waiting for POLLERR when disconnecting SCO
From: Luiz Augusto von Dentz <[email protected]>
To make sure the SCO link is really disconnected we should wait for POLLERR since POLLHUP does not necessarily means the link is completely disconnected just that no further data can be sent/received.
Note that this depend on a fix of SCO socket shutdown in kernel to wait for disconnect confimation to then kill/destroy the socket indicating the err/reason using POLLERR.
--- audio/headset.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
audio/headset.c +4 -1
@@ -2547,8 +2547,11 @@ void headset_set_state(struct audio_device *dev, headset_state_t state)emit_property_changed (dev->conn, dev->path,AUDIO_HEADSET_INTERFACE ,"State" ,DBUS_TYPE_STRING , &state_str); + +/* Do not watch HUP since we need to know when the link is +really disconnected */ hs->sco_id =g_io_add_watch (hs->sco, -G_IO_ERR |G_IO_HUP |G_IO_NVAL , +G_IO_ERR |G_IO_NVAL , (GIOFunc ) sco_cb, dev); g_dbus_emit_signal(dev->conn, dev->path,
Signature · 1 line
1.7.1
Hi Luiz,
Quoted 10 lines · Luiz Augusto von Dentz
To make sure the SCO link is really disconnected we should wait for POLLERR since POLLHUP does not necessarily means the link is completely disconnected just that no further data can be sent/received.
Note that this depend on a fix of SCO socket shutdown in kernel to wait for disconnect confimation to then kill/destroy the socket indicating the err/reason using POLLERR.
--- audio/headset.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
Pushed upstream. Thanks.
Johan