diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-08-29 11:53:59 +0200 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-08-29 16:09:03 +0200 |
commit | b08fb7759ed6926cfc3b87f5fe8e2f659ca9736f (patch) | |
tree | f9916b0a98226d4f9b51eebe16f65f2341cd575c /android/hidhost.c | |
parent | 8ecbe670849adb7d783126d9fdd03bbe9af027cd (diff) | |
download | bluez-b08fb7759ed6926cfc3b87f5fe8e2f659ca9736f.tar.gz |
android/hidhost: Add remove bond handling
With this patch HID/HOG is aware when remote device has been unpaired.
Diffstat (limited to 'android/hidhost.c')
-rw-r--r-- | android/hidhost.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/android/hidhost.c b/android/hidhost.c index 5b31c9590..476742ea4 100644 --- a/android/hidhost.c +++ b/android/hidhost.c @@ -1483,12 +1483,35 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data) } } +static void hid_unpaired_cb(const bdaddr_t *addr, uint8_t type) +{ + GSList *l; + struct hid_device *dev; + char address[18]; + + l = g_slist_find_custom(devices, addr, device_cmp); + if (!l) + return; + + dev = l->data; + + ba2str(addr, address); + DBG("Unpaired device %s", address); + + hid_device_remove(dev); +} + bool bt_hid_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode) { GError *err = NULL; DBG(""); + if (!bt_unpaired_register(hid_unpaired_cb)) { + error("hidhost: Could not register unpaired callback"); + return false; + } + bacpy(&adapter_addr, addr); ctrl_io = bt_io_listen(connect_cb, NULL, NULL, NULL, &err, @@ -1552,4 +1575,6 @@ void bt_hid_unregister(void) ipc_unregister(hal_ipc, HAL_SERVICE_ID_HIDHOST); hal_ipc = NULL; + + bt_unpaired_unregister(hid_unpaired_cb); } |