Diff between efc515d52323c546f3a8008d814f6dcd8d2628bd and 905032851aa912dc0ca1b78de8065cd2989ce45e

Changed Files

File Additions Deletions Status
src/adapter.c +0 -24 modified
src/device.c +12 -6 modified

Full Patch

diff --git a/src/adapter.c b/src/adapter.c
index 11be7b5..805a80a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4996,11 +4996,6 @@ static void dev_disconnected(struct btd_adapter *adapter,
 
 	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,
@@ -5583,19 +5578,6 @@ static void connected_callback(uint16_t index, 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,
@@ -5663,12 +5645,6 @@ static void connect_failed_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
@@ -2934,7 +2934,7 @@ static gboolean attrib_disconnected_cb(GIOChannel *io, GIOCondition cond,
 
 	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;
 	}
@@ -3155,11 +3155,10 @@ static void att_error_cb(const GError *gerr, gpointer user_data)
 	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)
@@ -3170,6 +3169,13 @@ 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);
 }