From 3508e02e9adc2ccde2df4a660217b57def834432 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Wed, 18 Feb 2015 16:12:34 -0800 Subject: [PATCH] core/gatt: Fix incorrect response on CCC read This patch fixes a bug where a CCC read on the local GATT server always returned a 0-length value. --- src/gatt-database.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gatt-database.c b/src/gatt-database.c index 5e83ce148..e8761411b 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -495,7 +495,7 @@ static void gatt_ccc_read_cb(struct gatt_db_attribute *attrib, goto done; } - len -= offset; + len = 2 - offset; value = len ? &ccc->value[offset] : NULL; done: @@ -517,7 +517,7 @@ static void gatt_ccc_write_cb(struct gatt_db_attribute *attrib, handle = gatt_db_attribute_get_handle(attrib); - DBG("CCC read called for handle: 0x%04x", handle); + DBG("CCC write called for handle: 0x%04x", handle); if (!value || len != 2) { ecode = BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN; -- 2.47.3