From cdc2355b608d8950998cbe99023bb58792883592 Mon Sep 17 00:00:00 2001 From: Petri Gynther Date: Thu, 1 Dec 2016 12:16:01 -0800 Subject: [PATCH] shared/gatt-client: Fix discover_primary_cb() Fix the handling of primary services discovery failure. --- src/shared/gatt-client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index 4386692f9..84145e706 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -1052,11 +1052,14 @@ static void discover_primary_cb(bool success, uint8_t att_ecode, "Primary service discovery failed." " ATT ECODE: 0x%02x", att_ecode); /* Reset error in case of not found */ - if (BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND) { + switch (att_ecode) { + case BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND: success = true; att_ecode = 0; + goto secondary; + default: + goto done; } - goto secondary; } if (!result || !bt_gatt_iter_init(&iter, result)) { -- 2.47.3