Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] android/hid: Fix not cleanup properly after disconnect
@ 2013-10-30 13:50 Luiz Augusto von Dentz
  2013-10-30 14:06 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-10-30 13:50 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If the device is disconnected it should be removed from the list of
connected devices and free its data.
---
 android/hid.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/android/hid.c b/android/hid.c
index d6ca4b9..b198713 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -149,15 +149,7 @@ static gboolean ctrl_watch_cb(GIOChannel *chan, GIOCondition cond,
 	if ((cond & (G_IO_HUP | G_IO_ERR)) && hdev->intr_watch)
 		g_io_channel_shutdown(chan, TRUE, NULL);
 
-	hdev->ctrl_watch = 0;
-
-	if (hdev->ctrl_io) {
-		g_io_channel_unref(hdev->ctrl_io);
-		hdev->ctrl_io = NULL;
-	}
-
-	if (hdev->intr_io && !(cond & G_IO_NVAL))
-		g_io_channel_shutdown(hdev->intr_io, TRUE, NULL);
+	hid_device_free(hdev);
 
 	return FALSE;
 }
@@ -230,8 +222,7 @@ static void control_connect_cb(GIOChannel *chan, GError *conn_err,
 	return;
 
 failed:
-	g_io_channel_unref(hdev->ctrl_io);
-	hdev->ctrl_io = NULL;
+	hid_device_free(hdev);
 }
 
 static uint8_t bt_hid_connect(struct hal_cmd_hid_connect *cmd, uint16_t len)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-30 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 13:50 [PATCH BlueZ] android/hid: Fix not cleanup properly after disconnect Luiz Augusto von Dentz
2013-10-30 14:06 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox