[PATCH 03/16] android/hidhost: Allow to use cached dev when connecting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is no reason to not allow connect when there is cached hid device
---
 android/hidhost.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/android/hidhost.c b/android/hidhost.c
index 652baa0..3dc3c25 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -867,12 +867,13 @@ static void bt_hid_connect(const void *buf, uint16_t len)
 	android2bdaddr(&cmd->bdaddr, &dst);
 
 	l = g_slist_find_custom(devices, &dst, device_cmp);
-	if (l) {
-		status = HAL_STATUS_FAILED;
-		goto failed;
-	}
+	if (l)
+		dev = l->data;
+	else
+		dev = hid_device_new(&dst);
 
-	dev = hid_device_new(&dst);
+	if (dev->state != HAL_HIDHOST_STATE_DISCONNECTED)
+		goto done;
 
 	ba2str(&dev->dst, addr);
 	DBG("connecting to %s", addr);
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux