diff --git a/src/adapter.c b/src/adapter.c
index 11be7b5..805a80a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
bonding_complete(adapter, &addr->bdaddr, addr->type,
MGMT_STATUS_DISCONNECTED);
-
- /* If this device should be connected through passive scanning
- * add it back to the connect_list */
- if (device && device_get_auto_connect(device))
- adapter_connect_list_add(adapter, device);
}
static void disconnect_complete(uint8_t status, uint16_t length,
}
eir_data_free(&eir_data);
-
- /*
- * If this was an LE device being connected through passive
- * scanning remove the device from the connect_list and give the
- * passive scanning another chance to be restarted in case
- * there are other devices in the connect_list.
- */
- if (device == adapter->connect_le) {
- adapter->connect_le = NULL;
- adapter->connect_list = g_slist_remove(adapter->connect_list,
- device);
- trigger_passive_scanning(adapter);
- }
}
static void device_blocked_callback(uint16_t index, uint16_t length,
device_bonding_failed(device, ev->status);
if (device_is_temporary(device))
adapter_remove_device(adapter, device, TRUE);
- if (device_is_le(device)) {
- if (device == adapter->connect_le)
- adapter->connect_le = NULL;
- if (device_get_auto_connect(device))
- adapter_connect_list_add(adapter, device);
- }
}
/* In the case of security mode 3 devices */
diff --git a/src/device.c b/src/device.c
index c13e2d0..bd0ee75 100644
--- a/src/device.c
+++ b/src/device.c
g_slist_foreach(device->attios, attio_disconnected, NULL);
- if (device->auto_connect == FALSE) {
+ if (!device_get_auto_connect(device)) {
DBG("Automatic connection disabled");
goto done;
}
if (g_error_matches(gerr, BT_IO_ERROR, ECONNABORTED))
return;
- if (device->auto_connect == FALSE)
- return;
-
- adapter_connect_list_add(device->adapter, device);
- DBG("Enabling automatic connections");
+ if (device_get_auto_connect(device)) {
+ DBG("Enabling automatic connections");
+ adapter_connect_list_add(device->adapter, device);
+ }
}
static void att_success_cb(gpointer user_data)
if (device->attios == NULL)
return;
+ /*
+ * Remove the device from the connect_list and give the passive
+ * scanning another chance to be restarted in case there are
+ * other devices in the connect_list.
+ */
+ adapter_connect_list_remove(device->adapter, device);
+
g_slist_foreach(device->attios, attio_connected, device->attrib);
}