linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BlueZ PATCH v2] shared/gatt-client:Ignore orphaned characteristics
@ 2020-05-01 19:22 Alain Michaud
  2020-05-01 20:45 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Alain Michaud @ 2020-05-01 19:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Alain Michaud

The gatt discovery proceedure simplification to discover all
characteristics at once has exposed a device side issue where some
device implementation reports orphaned characteristics.  While this
technically shouldn't be allowed, some instances of this were observed
(namely on some Android phones).

The fix is to simply skip over orphaned characteristics and continue
with everything else that is valid.

This has been tested as part of the Android CTS tests against an
affected platform and was confirmed to have worked around the issue.

Signed-off-by: Alain Michaud <alainm@chromium.org>
---

 src/shared/gatt-client.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 963ad619f..507b4d304 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -632,7 +632,13 @@ static bool discover_descs(struct discovery_op *op, bool *discovering)
 			util_debug(client->debug_callback, client->debug_data,
 				"Failed to insert characteristic at 0x%04x",
 				chrc_data->value_handle);
-			goto failed;
+
+			/* Some devices have been seen reporting orphaned
+			 * characteristics.  In order to favor interoperability
+			 * we skip over characteristics in error
+			 */
+			free(chrc_data);
+			continue;
 		}
 
 		if (gatt_db_attribute_get_handle(attr) !=
-- 
2.26.2.526.g744177e7f7-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [BlueZ PATCH v2] shared/gatt-client:Ignore orphaned characteristics
  2020-05-01 19:22 [BlueZ PATCH v2] shared/gatt-client:Ignore orphaned characteristics Alain Michaud
@ 2020-05-01 20:45 ` Luiz Augusto von Dentz
  2020-05-04  0:54   ` Alain Michaud
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2020-05-01 20:45 UTC (permalink / raw)
  To: Alain Michaud; +Cc: linux-bluetooth

Hi Alain,

On Fri, May 1, 2020 at 12:27 PM Alain Michaud <alainm@chromium.org> wrote:
>
> The gatt discovery proceedure simplification to discover all
> characteristics at once has exposed a device side issue where some
> device implementation reports orphaned characteristics.  While this
> technically shouldn't be allowed, some instances of this were observed
> (namely on some Android phones).
>
> The fix is to simply skip over orphaned characteristics and continue
> with everything else that is valid.
>
> This has been tested as part of the Android CTS tests against an
> affected platform and was confirmed to have worked around the issue.
>
> Signed-off-by: Alain Michaud <alainm@chromium.org>
> ---
>
>  src/shared/gatt-client.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
> index 963ad619f..507b4d304 100644
> --- a/src/shared/gatt-client.c
> +++ b/src/shared/gatt-client.c
> @@ -632,7 +632,13 @@ static bool discover_descs(struct discovery_op *op, bool *discovering)
>                         util_debug(client->debug_callback, client->debug_data,
>                                 "Failed to insert characteristic at 0x%04x",
>                                 chrc_data->value_handle);
> -                       goto failed;
> +
> +                       /* Some devices have been seen reporting orphaned
> +                        * characteristics.  In order to favor interoperability
> +                        * we skip over characteristics in error
> +                        */
> +                       free(chrc_data);
> +                       continue;
>                 }
>
>                 if (gatt_db_attribute_get_handle(attr) !=
> --
> 2.26.2.526.g744177e7f7-goog
>

Applied, thanks. Note that I drop the Signed-off-by line since we
don't use that on userspace.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BlueZ PATCH v2] shared/gatt-client:Ignore orphaned characteristics
  2020-05-01 20:45 ` Luiz Augusto von Dentz
@ 2020-05-04  0:54   ` Alain Michaud
  0 siblings, 0 replies; 3+ messages in thread
From: Alain Michaud @ 2020-05-04  0:54 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Alain Michaud, linux-bluetooth

Hi Luiz,

On Fri, May 1, 2020 at 4:46 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Alain,
>
> On Fri, May 1, 2020 at 12:27 PM Alain Michaud <alainm@chromium.org> wrote:
> >
> > The gatt discovery proceedure simplification to discover all
> > characteristics at once has exposed a device side issue where some
> > device implementation reports orphaned characteristics.  While this
> > technically shouldn't be allowed, some instances of this were observed
> > (namely on some Android phones).
> >
> > The fix is to simply skip over orphaned characteristics and continue
> > with everything else that is valid.
> >
> > This has been tested as part of the Android CTS tests against an
> > affected platform and was confirmed to have worked around the issue.
> >
> > Signed-off-by: Alain Michaud <alainm@chromium.org>
> > ---
> >
> >  src/shared/gatt-client.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
> > index 963ad619f..507b4d304 100644
> > --- a/src/shared/gatt-client.c
> > +++ b/src/shared/gatt-client.c
> > @@ -632,7 +632,13 @@ static bool discover_descs(struct discovery_op *op, bool *discovering)
> >                         util_debug(client->debug_callback, client->debug_data,
> >                                 "Failed to insert characteristic at 0x%04x",
> >                                 chrc_data->value_handle);
> > -                       goto failed;
> > +
> > +                       /* Some devices have been seen reporting orphaned
> > +                        * characteristics.  In order to favor interoperability
> > +                        * we skip over characteristics in error
> > +                        */
> > +                       free(chrc_data);
> > +                       continue;
> >                 }
> >
> >                 if (gatt_db_attribute_get_handle(attr) !=
> > --
> > 2.26.2.526.g744177e7f7-goog
> >
>
> Applied, thanks. Note that I drop the Signed-off-by line since we
> don't use that on userspace.
Thanks, sorry, this is automatically added by the tools I use to
automate the patch upload and I need to remember to remove it.  Sadly,
it's a manual process and is vulnerable to my poor memory :P
>
> --
> Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-04  0:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 19:22 [BlueZ PATCH v2] shared/gatt-client:Ignore orphaned characteristics Alain Michaud
2020-05-01 20:45 ` Luiz Augusto von Dentz
2020-05-04  0:54   ` Alain Michaud

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).