diff options
-rw-r--r-- | src/adapter.c | 14 | ||||
-rw-r--r-- | src/adapter.h | 1 | ||||
-rw-r--r-- | src/dbus-hci.c | 14 |
3 files changed, 17 insertions, 12 deletions
diff --git a/src/adapter.c b/src/adapter.c index 4926d14f..04c219ca 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2898,6 +2898,20 @@ void adapter_update_oor_devices(struct adapter *adapter) } } +void adapter_remove_oor_device(struct adapter *adapter, char *peer_addr) +{ + GSList *l; + + l = g_slist_find_custom(adapter->oor_devices, peer_addr, + (GCompareFunc) strcmp); + if (l) { + char *dev = l->data; + adapter->oor_devices = g_slist_remove(adapter->oor_devices, + dev); + g_free(dev); + } +} + int btd_register_adapter_driver(struct btd_adapter_driver *driver) { adapter_drivers = g_slist_append(adapter_drivers, driver); diff --git a/src/adapter.h b/src/adapter.h index 8b42dbad..d256b546 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -178,6 +178,7 @@ int adapter_add_found_device(struct adapter *adapter, bdaddr_t *bdaddr, int8_t rssi, name_status_t name_status); int adapter_remove_found_device(struct adapter *adapter, bdaddr_t *bdaddr); void adapter_update_oor_devices(struct adapter *adapter); +void adapter_remove_oor_device(struct adapter *adapter, char *peer_addr); struct btd_adapter_driver { const char *name; diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 175a69e4..57449cbb 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -1060,7 +1060,6 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, { char filename[PATH_MAX + 1]; struct adapter *adapter; - GSList *l; char local_addr[18], peer_addr[18], *name, *tmp_name; const char *paddr = peer_addr; struct remote_dev_info *dev, match; @@ -1094,18 +1093,9 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, state |= PERIODIC_INQUIRY; adapter_set_state(adapter, state); } - - if (adapter_get_state(adapter) & PERIODIC_INQUIRY) { /* Out of range list update */ - l = g_slist_find_custom(adapter->oor_devices, peer_addr, - (GCompareFunc) strcmp); - if (l) { - char *dev = l->data; - adapter->oor_devices = g_slist_remove(adapter->oor_devices, - dev); - g_free(dev); - } - } + if (adapter_get_state(adapter) & PERIODIC_INQUIRY) + adapter_remove_oor_device(adapter, peer_addr); memset(&match, 0, sizeof(struct remote_dev_info)); bacpy(&match.bdaddr, peer); |