From b3132fe96667c9f8a385e09726f35a154153e752 Mon Sep 17 00:00:00 2001 From: Ravi kumar Veeramally Date: Tue, 19 Nov 2013 16:56:28 +0200 Subject: [PATCH] android/hidhost: Free all connected devices in profile cleanup call This can be easily verified with haltest tool. --- android/hidhost.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/hidhost.c b/android/hidhost.c index df21f81c9..d0000a850 100644 --- a/android/hidhost.c +++ b/android/hidhost.c @@ -1223,6 +1223,14 @@ bool bt_hid_register(int sk, const bdaddr_t *addr) return true; } +static void free_hid_devices(gpointer data, gpointer user_data) +{ + struct hid_device *dev = data; + + bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED); + hid_device_free(dev); +} + void bt_hid_unregister(void) { DBG(""); @@ -1230,6 +1238,8 @@ void bt_hid_unregister(void) if (notification_sk < 0) return; + g_slist_foreach(devices, free_hid_devices, NULL); + devices = NULL; notification_sk = -1; if (ctrl_io) { -- 2.47.3