[Bluez PATCH v1 1/3] policy: add checks before connecting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Archie Pusaka <apusaka@xxxxxxxxxxxx>

When policy_connect() is called, there might be a case where the
device is not ready, or even the adapter is down. Add some checks
by calling btd_device_connect_services() instead of directly calling
btd_service_connect().

Reviewed-by: Sonny Sasaka <sonnysasaka@xxxxxxxxxxxx>
---

 plugins/policy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/policy.c b/plugins/policy.c
index ba9e1be020..42b15cb65f 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -106,6 +106,7 @@ static void policy_connect(struct policy_data *data,
 {
 	struct btd_profile *profile = btd_service_get_profile(service);
 	struct reconnect_data *reconnect;
+	GSList *l = NULL;
 
 	reconnect = reconnect_find(btd_service_get_device(service));
 	if (reconnect && reconnect->active)
@@ -113,7 +114,9 @@ static void policy_connect(struct policy_data *data,
 
 	DBG("%s profile %s", device_get_path(data->dev), profile->name);
 
-	btd_service_connect(service);
+	l = g_slist_prepend(l, service);
+	btd_device_connect_services(data->dev, l);
+	g_slist_free(l);
 }
 
 static void policy_disconnect(struct policy_data *data,
-- 
2.29.1.341.ge80a0c044ae-goog




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux