From d0d94ce35218005b7cdf67a49405c5bfff743d07 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Wed, 18 Feb 2015 00:18:38 -0800 Subject: [PATCH] shared/gatt: Don't incorrectly terminate discovery bt_gatt_client terminates discovery if no primary services are found within the given range. This behavior is incorrect, as the given handle range may contain secondary services and those should be discovered regardless. --- src/shared/gatt-client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index f4934f224..ac2692fdd 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -915,7 +915,7 @@ static void discover_primary_cb(bool success, uint8_t att_ecode, util_debug(client->debug_callback, client->debug_data, "Primary service discovery failed." " ATT ECODE: 0x%02x", att_ecode); - goto done; + goto secondary; } if (!result || !bt_gatt_iter_init(&iter, result)) { @@ -948,6 +948,7 @@ static void discover_primary_cb(bool success, uint8_t att_ecode, queue_push_tail(op->pending_svcs, attr); } +secondary: /* Discover secondary services */ if (bt_gatt_discover_secondary_services(client->att, NULL, op->start, op->end, -- 2.47.3