shared/gatt-client: Fix error when no service could be found
Luiz Augusto von Dentz
maintainerPATCH 1/2 shared/gatt-client: Fix error when no service could be found
From: Luiz Augusto von Dentz <[email protected]>
In case the remote device has no services available ready callback would be called with success set to false but in fact it has succeeded it just did not find anything.
--- src/shared/gatt-client.c | 5 +++++ 1 file changed, 5 insertions(+)
src/shared/gatt-client.c +5 -0
@@ -971,6 +971,11 @@ 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); +/* Reset error in case of not found */ +if (BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND ) { + success = true; + att_ecode =0 ; + } goto secondary; }
Signature · 1 line
2.1.0
Luiz Augusto von Dentz
maintainerPATCH 2/2 core/device: Fix not emitting Paired property
From: Luiz Augusto von Dentz <[email protected]>
Even if bt_gatt_client fails to discover services it should still call device_svc_resolved so the Paired propery is updated if pending and the device is properly stored, and at the end it still calls browse_request_complete to free up the resources.
--- src/device.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
src/device.c +1 -7
@@ -4188,13 +4188,7 @@ static void gatt_client_ready_cb(bool success, uint8_t att_ecode,DBG ("status: %s, error: %u" , success ?"success" :"failed" , att_ecode);if (!success) { -if (device->browse) { -struct browse_req *req = device->browse; - - device->browse =NULL ; -browse_request_complete (req, device->bdaddr_type, -EIO ); - } - +device_svc_resolved (device, device->bdaddr_type, -EIO );return ; }
Signature · 1 line
2.1.0
Hi,
Quoted 26 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
In case the remote device has no services available ready callback would be called with success set to false but in fact it has succeeded it just did not find anything.
--- src/shared/gatt-client.c | 5 +++++ 1 file changed, 5 insertions(+)src/shared/gatt-client.c +5
-1@@ -971,6 +971,11 @@ 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); +/* Reset error in case of not found */ +if (BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND ) { + success = true; + att_ecode =0 ; + } goto secondary; } --
Quoted 1 line
2.1.0
Applied.
Signature · 1 line
Luiz Augusto von Dentz