summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-10-12 10:40:21 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-10-12 18:02:34 +0300
commitf66abea5d817b8407f3d7b1a8ddb29dd5a0370f0 (patch)
treeaaa5cd8de972c4aba3da7e0c061cc51249347aa5 /src
parent826023de56896e83f35ae69a73d6a120a2f5b11e (diff)
adapter: Remove out of range devices tracking
With interleaved discovery the inquiry is so short that there's a good chance of nearby devices in not showing up during some cycles. This makes tracking "out of range" devices unreliable and it's therefore better to remove it. Devices get their RSSI property invalidated when a discovery cycle finishes so devices that are not found anymore can still be easily sorted with a lower priority by UIs.
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/src/adapter.c b/src/adapter.c
index f1e6e1fa..a39a3a13 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -134,7 +134,6 @@ struct btd_adapter {
uint8_t global_mode; /* last valid global mode */
struct session_req *pending_mode;
GSList *found_devices;
- GSList *oor_devices; /* out of range device list */
struct agent *agent; /* For the new API */
guint auth_idle_id; /* Pending authorization dequeue */
GQueue *auths; /* Ongoing and pending auths */
@@ -503,11 +502,6 @@ static uint8_t get_needed_mode(struct btd_adapter *adapter, uint8_t mode)
/* Called when a session gets removed or the adapter is stopped */
static void stop_discovery(struct btd_adapter *adapter)
{
- if (adapter->oor_devices) {
- g_slist_free(adapter->oor_devices);
- adapter->oor_devices = NULL;
- }
-
/* Reset if suspended, otherwise remove timer (software scheduler)
* or request inquiry to stop */
if (adapter->discov_suspended) {
@@ -1034,9 +1028,6 @@ static DBusMessage *adapter_start_discovery(DBusConnection *conn,
g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
- g_slist_free(adapter->oor_devices);
- adapter->oor_devices = NULL;
-
if (adapter->discov_suspended)
goto done;
@@ -1610,8 +1601,6 @@ static const GDBusSignalTable adapter_signals[] = {
{ GDBUS_SIGNAL("DeviceFound",
GDBUS_ARGS({ "address", "s" },
{ "values", "a{sv}" })) },
- { GDBUS_SIGNAL("DeviceDisappeared",
- GDBUS_ARGS({ "address", "s" })) },
{ }
};
@@ -2122,24 +2111,6 @@ static void call_adapter_powered_callbacks(struct btd_adapter *adapter,
g_slist_foreach(adapter->devices, set_auto_connect, &powered);
}
-static void emit_device_disappeared(gpointer data, gpointer user_data)
-{
- struct btd_device *dev = data;
- struct btd_adapter *adapter = user_data;
- char address[18];
- const char *paddr = address;
-
- ba2str(device_get_address(dev), address);
-
- g_dbus_emit_signal(btd_get_dbus_connection(), adapter->path,
- ADAPTER_INTERFACE, "DeviceDisappeared",
- DBUS_TYPE_STRING, &paddr,
- DBUS_TYPE_INVALID);
-
- if (device_is_temporary(dev))
- adapter_remove_device(adapter, dev, TRUE);
-}
-
void btd_adapter_get_mode(struct btd_adapter *adapter, uint8_t *mode,
uint8_t *on_mode,
uint16_t *discoverable_timeout,
@@ -2465,8 +2436,6 @@ static void adapter_free(gpointer user_data)
g_slist_free(adapter->found_devices);
- g_slist_free(adapter->oor_devices);
-
g_slist_free(adapter->connections);
g_free(adapter->path);
@@ -2629,15 +2598,12 @@ void adapter_set_discovering(struct btd_adapter *adapter,
if (discovering)
return;
- g_slist_foreach(adapter->oor_devices, emit_device_disappeared, adapter);
- g_slist_free(adapter->oor_devices);
-
for (l = adapter->found_devices; l != NULL; l = g_slist_next(l)) {
struct btd_device *dev = l->data;
device_set_rssi(dev, 0);
}
- adapter->oor_devices = adapter->found_devices;
+ g_slist_free(adapter->found_devices);
adapter->found_devices = NULL;
if (adapter->discov_suspended)
@@ -2667,11 +2633,6 @@ static void suspend_discovery(struct btd_adapter *adapter)
DBG("Suspending discovery");
- if (adapter->oor_devices) {
- g_slist_free(adapter->oor_devices);
- adapter->oor_devices = NULL;
- }
-
adapter->discov_suspended = TRUE;
if (adapter->discov_id > 0) {
@@ -2783,10 +2744,6 @@ void adapter_update_found_devices(struct btd_adapter *adapter,
eir_data_free(&eir_data);
- if (device_is_bredr(dev))
- adapter->oor_devices = g_slist_remove(adapter->oor_devices,
- dev);
-
if (g_slist_find(adapter->found_devices, dev))
return;