struct btd_adapter *adapter = user_data;
struct btd_device *device;
char addr[18];
- GSList *list;
+ GSList *list = NULL;
if (length < sizeof(*ev)) {
error("Too small le conn update completed event");
}
ba2str(&ev->addr.bdaddr, addr);
- list = g_slist_find_custom(adapter->devices, addr,
+ if (ev->addr.type == BDADDR_LE_PUBLIC) {
+ /* LE Public or Private Random Address */
+ list = g_slist_find_custom(adapter->devices, addr,
+ device_rpa_ida_cmp);
+ } else if (ev->addr.type == BDADDR_LE_RANDOM) {
+ /* Static Random address */
+ list = g_slist_find_custom(adapter->devices, addr,
device_address_cmp);
+ }
+
if (list) {
device = list->data;
+ device_print_addr(device);
+
if (device_get_conn_update_state(device))
device_set_conn_update_state(device, false);
}
return bacmp(&device->bdaddr, bdaddr);
}
+
+int device_rpa_ida_cmp(gconstpointer a, gconstpointer b)
+{
+ const struct btd_device *device = a;
+ const char *address = b;
+ char addr[18];
+
+ if (!device->rpa || device->le == false)
+ return -1;
+
+ ba2str(&device->bdaddr, addr);
+ return strcasecmp(addr, address);
+}
#endif
int device_address_cmp(gconstpointer a, gconstpointer b)
bool device_get_rpa_exist(struct btd_device *device);
int device_rpa_cmp(gconstpointer a, gconstpointer b);
int device_addr_cmp(gconstpointer a, gconstpointer b);
+int device_rpa_ida_cmp(gconstpointer a, gconstpointer b);
void device_remove_stored_folder(struct btd_device *device);
const uint8_t *device_get_irk_value(struct btd_device *device);
void device_set_irk_value(struct btd_device *device, const uint8_t *val);