From a0ad13ddd2778c35ebbcdc4341dbc393d13c0fc3 Mon Sep 17 00:00:00 2001 From: Grzegorz Kolodziejczyk Date: Mon, 23 Jun 2014 16:18:17 +0200 Subject: [PATCH] android/hidhost: Fix adding hidhost device on devices list Create hog connection cb functionality tried to operate on stored on list hidhost device. Adding hidhost device to list should be done before operating on it. It caused sending bogus connecting state change. --- android/hidhost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/android/hidhost.c b/android/hidhost.c index 846dd573c..fdbe885a5 100644 --- a/android/hidhost.c +++ b/android/hidhost.c @@ -846,9 +846,12 @@ static void bt_hid_connect(const void *buf, uint16_t len) ba2str(&dev->dst, addr); DBG("connecting to %s", addr); + devices = g_slist_append(devices, dev); + if (bt_is_device_le(&dst)) { if (!hog_connect(dev)) { status = HAL_STATUS_FAILED; + hid_device_remove(dev); goto failed; } goto done; @@ -864,8 +867,6 @@ static void bt_hid_connect(const void *buf, uint16_t len) } done: - devices = g_slist_append(devices, dev); - if (dev->state == HAL_HIDHOST_STATE_DISCONNECTED) bt_hid_notify_state(dev, HAL_HIDHOST_STATE_CONNECTING); -- 2.47.3