summaryrefslogtreecommitdiff
path: root/android/hidhost.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-09-02 12:09:48 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-09-02 17:12:52 +0200
commit04d98fe2a9f772aec452b2bbc6d3da395c6d79ad (patch)
treec8a2a7a802b3d0436d0bc4bd1e01d6c2a9b104eb /android/hidhost.c
parentbdf0701768697b46429ddfdfb401edea4984db20 (diff)
downloadbluez-04d98fe2a9f772aec452b2bbc6d3da395c6d79ad.tar.gz
android/hidhost: Allow to use cached dev when connecting
There is no reason to not allow connect when there is cached hid device
Diffstat (limited to 'android/hidhost.c')
-rw-r--r--android/hidhost.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/android/hidhost.c b/android/hidhost.c
index 652baa00f..3dc3c2535 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);