From 22ecdfbbc61ce923d2cfa672d9a48d8a7c972c69 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 11 Dec 2012 14:06:22 +0200 Subject: [PATCH] core: Auto-connect new profiles if Device.Connect was called --- src/device.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index 15a34ce5d..e6afe6460 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) -- 2.47.3