summaryrefslogtreecommitdiff
path: root/profiles/input
diff options
context:
space:
mode:
authorArchie Pusaka <apusaka@chromium.org>2020-06-10 23:04:46 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-06-10 13:20:42 -0700
commit69d7d42e896e2ab6a23b62692a1011d552c42cc9 (patch)
tree01a10cceca66e0e52bf30d839c6fefb58d512962 /profiles/input
parent7155d7af192004eaf0b213d175beb1064796ea12 (diff)
downloadbluez-69d7d42e896e2ab6a23b62692a1011d552c42cc9.tar.gz
input: Disconnect ctrl chan only if intr chan was disconnected by us
If the intr channel was disconnected by the other party, then they are also responsible to close the ctrl channel. Such disconnection message would have the G_IO_ERR flag set, as opposed to it being unset if the disconnection is initiated by us. There doesn't seem to be an explicit rule in the specification about this behavior, but this is enforced in the PTS qualification tool.
Diffstat (limited to 'profiles/input')
-rw-r--r--profiles/input/device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/profiles/input/device.c b/profiles/input/device.c
index e2ea459fe..d3724ed54 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -333,8 +333,10 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
idev->intr_io = NULL;
}
- /* Close control channel */
- if (idev->ctrl_io && !(cond & G_IO_NVAL))
+ /* Close control channel if the closing of interrupt channel is not
+ * initiated by the other party
+ */
+ if (idev->ctrl_io && !(cond & (G_IO_NVAL | G_IO_ERR)))
g_io_channel_shutdown(idev->ctrl_io, TRUE, NULL);
btd_service_disconnecting_complete(idev->service, 0);