Skip to contentSkip to conversation

shared/gatt-client: Fix not marking service as active

PATCH In review Luiz Augusto von Dentz 2 participants 2 messages Dec 16, 2022 – Dec 17, 2022 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v3 1/1 shared/gatt-client: Fix not marking service as active

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

If there are no characteristics to discover, or for some reason bt_gatt_discover_descriptors is skiped, or the last attribute is actually a included service the service should be marked as active as there will be no more attributes to be discovered.

---
 src/shared/gatt-client.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
src/shared/gatt-client.c +18 -1
index cf0d2e2b749d..8eb5e0fea621 100644
@@ -576,12 +576,26 @@ static void discover_incl_cb(bool success, uint8_t att_ecode,
 				gatt_db_attribute_get_handle(attr), handle);
 			goto failed;
 		}
+
+		if (!gatt_db_attribute_get_service_data(attr, NULL, &end,
+							NULL, NULL)) {
+			DBG(client, "Unable to get service data at 0x%04x",
+								handle);
+			goto failed;
+		}
+
+		/* Skip if there are no attributes */
+		if (handle == end)
+			gatt_db_service_set_active(attr, true);
 	}
 
 next:
 	range = queue_pop_head(op->discov_ranges);
-	if (!range)
+	if (!range) {
+		/* Skip if there are no attributes */
+		gatt_db_service_set_active(op->cur_svc, true);
 		goto failed;
+	}
 
 	client->discovery_req = bt_gatt_discover_characteristics(client->att,
 							range->start,
@@ -696,6 +710,9 @@ static bool discover_descs(struct discovery_op *op, bool *discovering)
 							&ccc_uuid, 0, NULL,
 							NULL, NULL);
 			if (attr) {
+				if (dest_start == end)
+					/* Done with the current service */
+					gatt_db_service_set_active(attr, true);
 				free(chrc_data);
 				continue;
 			}
Signature · 1 line
2.37.3
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=705282

---Test result---

Test Summary:

CheckPatch                    PASS      0.82 seconds
GitLint                       PASS      0.31 seconds
BuildEll                      PASS      30.94 seconds
BluezMake                     FAIL      14.99 seconds
MakeCheck                     FAIL      21.48 seconds
MakeDistcheck                 FAIL      35.57 seconds
CheckValgrind                 FAIL      15.16 seconds
bluezmakeextell               FAIL      12.06 seconds
IncrementalBuild              FAIL      15.58 seconds
ScanBuild                     FAIL      572.86 seconds

Details
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

src/shared/gatt-client.c: In function ‘discover_descs’:
src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?

  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:8220: src/shared/libshared_mainloop_la-gatt-client.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4482: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

src/shared/gatt-client.c: In function ‘discover_descs’:
src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?

  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:8017: src/shared/libshared_glib_la-gatt-client.lo] Error 1
make: *** [Makefile:11684: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

../../src/shared/gatt-client.c: In function ‘discover_descs’:
../../src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?

  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

../../src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [Makefile:8220: src/shared/libshared_mainloop_la-gatt-client.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4482: all] Error 2
make: *** [Makefile:11605: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

src/shared/gatt-client.c: In function ‘discover_descs’:
src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?

  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:8220: src/shared/libshared_mainloop_la-gatt-client.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:11684: check] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

src/shared/gatt-client.c: In function ‘discover_descs’:
src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?

  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:8220: src/shared/libshared_mainloop_la-gatt-client.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4482: all] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
[BlueZ,v3] shared/gatt-client: Fix not marking service as active

src/shared/gatt-client.c: In function ‘discover_descs’:
src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?

  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:8220: src/shared/libshared_mainloop_la-gatt-client.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4482: all] Error 2
##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:

src/shared/ad.c:369:19: warning: Use of zero-allocated memory

                                buf[(*pos)++] = ad_type;
                                              ^
1 warning generated.
src/shared/gatt-client.c: In function ‘discover_descs’:
src/shared/gatt-client.c:713:9: error: ‘dest_start’ undeclared (first use in this function); did you mean ‘desc_start’?
  713 |     if (dest_start == end)
      |         ^~~~~~~~~~
      |         desc_start

src/shared/gatt-client.c:713:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:8220: src/shared/libshared_mainloop_la-gatt-client.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4482: all] Error 2

---
Regards,
Linux Bluetooth