OSDN Git Service

Bluetooth does not provide unique identifier for HID devices
authorZhihai Xu <zhihaixu@google.com>
Wed, 11 Dec 2013 19:46:36 +0000 (11:46 -0800)
committerZhihai Xu <zhihaixu@google.com>
Wed, 11 Dec 2013 19:46:36 +0000 (11:46 -0800)
use remote device MAC address as the ID in uhid device.
make the format backward compatible with BlueZ.

bug:12083633
Change-Id: I6edfe94e67b806dbb68820e0ce5582ad3c04753f

btif/co/bta_hh_co.c

index 51edcd4..9db3370 100644 (file)
@@ -419,6 +419,11 @@ void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, char *dev_name, UINT16 ven
     memset(&ev, 0, sizeof(ev));
     ev.type = UHID_CREATE;
     strncpy((char*)ev.u.create.name, dev_name, sizeof(ev.u.create.name) - 1);
+    snprintf((char*)ev.u.create.uniq, sizeof(ev.u.create.uniq),
+             "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
+             p_dev->bd_addr.address[5], p_dev->bd_addr.address[4],
+             p_dev->bd_addr.address[3], p_dev->bd_addr.address[2],
+             p_dev->bd_addr.address[1], p_dev->bd_addr.address[0]);
     ev.u.create.rd_size = dscp_len;
     ev.u.create.rd_data = p_dscp;
     ev.u.create.bus = BUS_BLUETOOTH;