return dev->le;
}
+const bdaddr_t *bt_get_id_addr(const bdaddr_t *addr, uint8_t *type)
+{
+ struct device *dev;
+
+ dev = find_device(addr);
+ if (!dev)
+ return NULL;
+
+ if (type)
+ *type = dev->bdaddr_type;
+
+ return &dev->bdaddr;
+}
+
const char *bt_get_adapter_name(void)
{
return adapter.name;
void bt_store_gatt_ccc(const bdaddr_t *addr, uint16_t value);
uint16_t bt_get_gatt_ccc(const bdaddr_t *addr);
+
+const bdaddr_t *bt_get_id_addr(const bdaddr_t *addr, uint8_t *type);
GIOChannel *io;
GError *gerr = NULL;
char addr[18];
+ const bdaddr_t *bdaddr;
+ uint8_t bdaddr_type;
ba2str(&dev->bdaddr, addr);
BT_IO_SEC_LOW;
/*
+ * If address type is random it might be that IRK was received and
+ * random is just for faking Android Framework. ID address should be
+ * used for connection if present.
+ */
+ if (dev->bdaddr_type == BDADDR_LE_RANDOM) {
+ bdaddr = bt_get_id_addr(&dev->bdaddr, &bdaddr_type);
+ if (!bdaddr)
+ return -EINVAL;
+ } else {
+ bdaddr = &dev->bdaddr;
+ bdaddr_type = dev->bdaddr_type;
+ }
+
+ /*
* This connection will help us catch any PDUs that comes before
* pairing finishes
*/
BT_IO_OPT_SOURCE_BDADDR,
&adapter_addr,
BT_IO_OPT_SOURCE_TYPE, BDADDR_LE_PUBLIC,
- BT_IO_OPT_DEST_BDADDR, &dev->bdaddr,
- BT_IO_OPT_DEST_TYPE, dev->bdaddr_type,
+ BT_IO_OPT_DEST_BDADDR, bdaddr,
+ BT_IO_OPT_DEST_TYPE, bdaddr_type,
BT_IO_OPT_CID, ATT_CID,
BT_IO_OPT_SEC_LEVEL, sec_level,
BT_IO_OPT_INVALID);