From af61102ae18659d4420753db7fcea7f4ad1a12cf Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 12 Mar 2019 18:25:58 +0200 Subject: [PATCH] Bluetooth: GATT: Skip Characteristic Value when discovering Descriptors Those are not considered Descriptors and shall be discovered with use of BT_GATT_DISCOVER_CHARACTERISTIC. Signed-off-by: Luiz Augusto von Dentz --- subsys/bluetooth/host/gatt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 6d4b5024f6..1a201b35a6 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -2255,8 +2255,18 @@ static void gatt_find_info_rsp(struct bt_conn *conn, u8_t err, /* Skip attributes that are not considered descriptors */ if (!bt_uuid_cmp(&u.uuid, BT_UUID_GATT_PRIMARY) || !bt_uuid_cmp(&u.uuid, BT_UUID_GATT_SECONDARY) || - !bt_uuid_cmp(&u.uuid, BT_UUID_GATT_INCLUDE) || - !bt_uuid_cmp(&u.uuid, BT_UUID_GATT_CHRC)) { + !bt_uuid_cmp(&u.uuid, BT_UUID_GATT_INCLUDE)) { + continue; + } + + /* If Characteristic Declaration skip ahead as the next entry + * must be its value. + */ + if (!bt_uuid_cmp(&u.uuid, bt_uuid_gatt_chrc)) { + if (length >= len) { + pdu = (const u8_t *)pdu + len; + length -= len; + } continue; }