Skip to contentSkip to conversation

core/gatt: Fix not exporting new services

PATCH Applied Luiz Augusto von Dentz 1 participant 2 messages Sep 4, 2015 – Sep 6, 2015 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 core/gatt: Fix not exporting new services

From: Luiz Augusto von Dentz <[email protected]>

Ever since cache validation was introduced the services are no longer cleared on disconnect so checking for queue empty is not valid anymore.

---
 src/gatt-client.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
src/gatt-client.c +4 -5
index 3356ee4..d8a3429 100644
@@ -1538,6 +1538,9 @@ static struct service *service_create(struct gatt_db_attribute *attr,
 	/* Set service active so we can skip discovering next time */
 	gatt_db_service_set_active(attr, true);
 
+	/* Mark the service as claimed since it going to be exported */
+	gatt_db_service_set_claimed(attr, true);
+
 	return service;
 }
 
@@ -1840,11 +1843,7 @@ void btd_gatt_client_ready(struct btd_gatt_client *client)
 
 	DBG("GATT client ready");
 
-	if (queue_isempty(client->services)) {
-		DBG("Exporting services");
-		create_services(client);
-		return;
-	}
+	create_services(client);
 
 	/*
 	 * Services have already been created before. Re-enable notifications
Signature · 1 line
2.4.3
author maintainer Applied
#1 lore raw

Hi,

Quoted 36 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Ever since cache validation was introduced the services are no longer cleared on disconnect so checking for queue empty is not valid anymore.

---
 src/gatt-client.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
src/gatt-client.c +4 -6
index 3356ee4..d8a3429 100644
@@ -1538,6 +1538,9 @@ static struct service *service_create(struct gatt_db_attribute *attr,
        /* Set service active so we can skip discovering next time */
        gatt_db_service_set_active(attr, true);
 
+       /* Mark the service as claimed since it going to be exported */
+       gatt_db_service_set_claimed(attr, true);
+
        return service;
 }
 
@@ -1840,11 +1843,7 @@ void btd_gatt_client_ready(struct btd_gatt_client *client)
 
        DBG("GATT client ready");
 
-       if (queue_isempty(client->services)) {
-               DBG("Exporting services");
-               create_services(client);
-               return;
-       }
+       create_services(client);
 
        /*
         * Services have already been created before. Re-enable notifications
--
Quoted 1 line

2.4.3

Applied.

Signature · 1 line
Luiz Augusto von Dentz