Diff between 5e2275640c12c5167f3d0e257d0293faa5e508b6 and 22ecdfbbc61ce923d2cfa672d9a48d8a7c972c69

Changed Files

File Additions Deletions Status
src/device.c +13 -3 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index 15a34ce..e6afe64 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2282,12 +2282,22 @@ void device_probe_profile(gpointer a, gpointer b)
 	ba2str(&device->bdaddr, addr);
 
 	err = profile->device_probe(profile, device, probe_uuids);
-	if (err < 0)
+	if (err < 0) {
 		error("%s profile probe failed for %s", profile->name, addr);
-	else
-		device->profiles = g_slist_append(device->profiles, profile);
+		g_slist_free(probe_uuids);
+		return;
+	}
 
+	device->profiles = g_slist_append(device->profiles, profile);
 	g_slist_free(probe_uuids);
+
+	if (!profile->auto_connect || !device->general_connect)
+		return;
+
+	device->pending = g_slist_append(device->pending, profile);
+
+	if (g_slist_length(device->pending) == 1)
+		connect_next(device);
 }
 
 void device_remove_profile(gpointer a, gpointer b)