diff --git a/src/adapter.c b/src/adapter.c
index 805a80a..8a1c870 100644
--- a/src/adapter.c
+++ b/src/adapter.c
GSList *connections; /* Connected devices */
GSList *devices; /* Devices structure pointers */
GSList *connect_list; /* Devices to connect when found */
- bool passive_scanning; /* Passive (LE) scanning enabled */
struct btd_device *connect_le; /* LE device waiting to be connected */
sdp_list_t *services; /* Services associated to adapter */
if (status == MGMT_STATUS_SUCCESS) {
adapter->discovery_type = rp->type;
adapter->discovery_enable = 0x01;
- adapter->passive_scanning = true;
}
}
adapter->discovery_type = ev->type;
adapter->discovery_enable = ev->discovering;
- if (!adapter->discovery_enable)
- adapter->passive_scanning = false;
-
/*
* Check for existing discoveries triggered by client applications
* and ignore all others.
/*
* Only if at least one client has requested discovery, maintain
* list of found devices and name confirming for legacy devices.
+ * Otherwise, this is an event from passive discovery and we
+ * should check if the device needs connecting to.
*/
if (!adapter->discovery_list)
- goto done;
+ goto connect_le;
if (g_slist_find(adapter->discovery_found, dev))
return;
adapter->discovery_found = g_slist_prepend(adapter->discovery_found,
dev);
-done:
- /* Don't trigger LE connections through normal discovery */
- if (!adapter->passive_scanning)
- return;
+ return;
+connect_le:
/*
* If this is an LE device that's not connected and part of the
* connect_list stop passive scanning so that a connection