* [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb()
@ 2016-12-01 20:16 Petri Gynther
2016-12-01 20:16 ` [PATCH 2/2] shared/gatt-client: Fix discover_secondary_cb() Petri Gynther
2016-12-01 20:46 ` [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Luiz Augusto von Dentz
0 siblings, 2 replies; 4+ messages in thread
From: Petri Gynther @ 2016-12-01 20:16 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz, Petri Gynther
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 4386692..84145e7 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.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] shared/gatt-client: Fix discover_secondary_cb()
2016-12-01 20:16 [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Petri Gynther
@ 2016-12-01 20:16 ` Petri Gynther
2016-12-01 20:46 ` [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Luiz Augusto von Dentz
1 sibling, 0 replies; 4+ messages in thread
From: Petri Gynther @ 2016-12-01 20:16 UTC (permalink / raw)
To: linux-bluetooth; +Cc: luiz.dentz, Petri Gynther
If included services discovery cannot be started, the services discovery
operation has failed.
---
src/shared/gatt-client.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 84145e7..dc98aaa 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1027,6 +1027,7 @@ next:
util_debug(client->debug_callback, client->debug_data,
"Failed to start included services discovery");
discovery_op_unref(op);
+ success = false;
done:
discovery_op_complete(op, success, att_ecode);
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb()
2016-12-01 20:16 [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Petri Gynther
2016-12-01 20:16 ` [PATCH 2/2] shared/gatt-client: Fix discover_secondary_cb() Petri Gynther
@ 2016-12-01 20:46 ` Luiz Augusto von Dentz
2016-12-02 11:53 ` Luiz Augusto von Dentz
1 sibling, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-12-01 20:46 UTC (permalink / raw)
To: Petri Gynther; +Cc: linux-bluetooth@vger.kernel.org
Hi Petri,
On Thu, Dec 1, 2016 at 10:16 PM, Petri Gynther <pgynther@google.com> wrote:
> 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 4386692..84145e7 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.8.0.rc3.226.g39d4020
Looks like we had similar idea, although this is probably better as
other errors shall be cause the discovery to be interrupted.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb()
2016-12-01 20:46 ` [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Luiz Augusto von Dentz
@ 2016-12-02 11:53 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-12-02 11:53 UTC (permalink / raw)
To: Petri Gynther; +Cc: linux-bluetooth@vger.kernel.org
Hi Petri,
On Thu, Dec 1, 2016 at 10:46 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Petri,
>
> On Thu, Dec 1, 2016 at 10:16 PM, Petri Gynther <pgynther@google.com> wrote:
>> 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 4386692..84145e7 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.8.0.rc3.226.g39d4020
>
> Looks like we had similar idea, although this is probably better as
> other errors shall be cause the discovery to be interrupted.
Applied, thanks
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-02 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 20:16 [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Petri Gynther
2016-12-01 20:16 ` [PATCH 2/2] shared/gatt-client: Fix discover_secondary_cb() Petri Gynther
2016-12-01 20:46 ` [PATCH 1/2] shared/gatt-client: Fix discover_primary_cb() Luiz Augusto von Dentz
2016-12-02 11:53 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).