From de9191b5f45de46c4fb547f9a08e73777788be40 Mon Sep 17 00:00:00 2001 From: Marcin Kraglak Date: Thu, 23 Oct 2014 12:15:37 +0200 Subject: [PATCH] shared/gatt: Fix searching descriptors Descriptor discovery range started from characteristic value handle + 1 and end with characteristic end handle. If characteristic value handle is 0xffff, then discovery range was set to 0x0000-0xffff. Found during PTS test case TC_GAD_CL_BV_03_C. --- src/shared/gatt-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index c591c9ec5..57d3e1f51 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -706,8 +706,8 @@ static void discover_chrcs_cb(bool success, uint8_t att_ecode, for (i = 0; i < chrc_count; i++) { op->cur_chrc_index = i; op->cur_chrc = chrcs + i; - desc_start = chrcs[i].chrc_external.value_handle + 1; - if (desc_start > chrcs[i].chrc_external.end_handle) + desc_start = chrcs[i].chrc_external.value_handle; + if (desc_start++ == chrcs[i].chrc_external.end_handle) continue; if (bt_gatt_discover_descriptors(client->att, desc_start, -- 2.47.3