summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-12-11 14:06:22 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-12-11 14:06:22 +0200
commit22ecdfbbc61ce923d2cfa672d9a48d8a7c972c69 (patch)
tree5babacb5bc3ccb2d688e9679a7e61cd0a08b0951 /src
parent5e2275640c12c5167f3d0e257d0293faa5e508b6 (diff)
downloadbluez-22ecdfbbc61ce923d2cfa672d9a48d8a7c972c69.tar.gz
core: Auto-connect new profiles if Device.Connect was called
Diffstat (limited to 'src')
-rw-r--r--src/device.c16
1 files 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)