All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Pigg <adam@piggz.co.uk>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: GATT issue, possible bluez bug?
Date: Tue, 22 Mar 2022 07:55:48 +0000	[thread overview]
Message-ID: <CANFkB1yr3N_Twac=ocxBRst79-gmdu8=6VTD6oPgdGT0rb_HaQ@mail.gmail.com> (raw)
In-Reply-To: <CABBYNZLjV3PQ7Hm3PJZcTcs64aLzWLBNfooSYuZmSywv0RJG0g@mail.gmail.com>

Hi Luiz

On Tue, 22 Mar 2022 at 00:44, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Adam,
>
> On Mon, Mar 21, 2022 at 4:03 PM Adam Pigg <adam@piggz.co.uk> wrote:
> >
> > Hi
> >
> > A bit of background, I write a linux desktop/mobile app called
> > Amazfish which interfaces with several watches over BLE using their
> > GATT services.  To do this, I use the bluez dbus api (technically a
> > thin wrapper around it I wrote called qble
> > https://github.com/piggz/qble)
> >
> > All has been good so far, I support several generations of
> > Huami/Amazfit watches, as well as the open source Pinetime and
> > Bangle.js.  For the Amazfit watches, i have implementations for older
> > devies such as the Bip, and newer ones such as the GTS.
> >
> > Much of the reverse engineering comes from the Android Gadget Bridge
> > project, which supports many more devices.
> >
> > My community of users donated to buy me a newer device called a GTR2,
> > which, according to the GB devs uses the same protocol as the slightly
> > older GTS, and the packet captures I have from Android would support
> > this.
> >
> > But this is where my trouble starts with Bluez, my existing
> > implementation doesnt work at all.  Normally, after a connection, I
> > would wait for the ServicesResolved signal, which happens pretty fast
> > on all other devices, but on the GTR2, it takes about 30 seconds, by
> > which time, the watch has disconnected. (i get a disconnected signal
> > immediately after the ServicesResolved signal)
> >
> > To rule out my code, I have tried several things:
> > Gatttool
> > With gattool, i can connect, get the services, enable a notification,
> > write a value and get the expected results seemingly fine
> >
> > Python-gatt (using the bluez dbus api)
> > Im unable to iterate the services, like my app, it takes 30 seconds to
> > get the signal and then swiftly disconnects
> >
> > Gattlib (https://github.com/labapart/gattlib)
> > Gattlib is interesting as it appears to have "borrowed" much of its
> > code directly from bluez.  When built against the system bluez, if the
> > version is > 5.42, it will use the dbus api.  When I do this, again im
> > unable to list services on the watch.  However, if I edit the build to
> > force it to use its internal gatt implementation, which appears to be
> > the same one used by gatttool, then, it IS able to interrogate the
> > watch.
> >
> > I have attached 3 files
> > 1. test python program which should print services, and associated btmon
> > 2. btmon output while using gatttool
> > 3. btmon output running gattlib discover example
> >
> > Note, other than discovery, I havnt been able to get gattlib to
> > read/write/notify!
> >
> > It seems as though I may be triggering a bug in the bluez dbus api?
> > Can anyone suggest anything?
>
> What version are you using? I would first try with the latest to see
> if that something already fixed.
>
>
Im using 5.63 already, which is the latest tag (on opensuse tumbleweed)

I'll also try bluetoothctl and attach logs using that, though I
suspect it will behave the same as the python library and my own
library.

> --
> Luiz Augusto von Dentz

  parent reply	other threads:[~2022-03-22  7:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20 18:44 GATT issue, possible bluez bug? Adam Pigg
2022-03-22  0:43 ` Luiz Augusto von Dentz
2022-03-22  6:04   ` Luiz Augusto von Dentz
2022-03-22  7:55   ` Adam Pigg [this message]
2022-03-22 10:40     ` Adam Pigg
2022-03-22 21:35       ` Luiz Augusto von Dentz
2022-03-22 23:09         ` Adam Pigg
2022-03-22 23:35           ` Luiz Augusto von Dentz
2022-03-22 23:43             ` Luiz Augusto von Dentz
2022-03-23  9:11               ` Adam Pigg
2022-03-23 13:36                 ` Adam Pigg
2022-03-23 14:46                   ` Adam Pigg
2022-03-23 19:45                     ` Luiz Augusto von Dentz
2022-03-23 19:52                       ` Luiz Augusto von Dentz
2022-03-23 19:57                       ` Adam Pigg
2022-03-28 16:37                         ` Adam Pigg
2022-04-01 20:12                           ` Adam Pigg
2022-04-01 21:49                             ` Luiz Augusto von Dentz
2022-04-02  8:26                               ` Adam Pigg
2022-04-02  9:14                                 ` Adam Pigg
2022-04-04 19:07                                   ` Adam Pigg
2022-04-04 20:12                                     ` Luiz Augusto von Dentz
2022-04-04 20:24                                       ` Adam Pigg
2022-04-04 20:29                                         ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANFkB1yr3N_Twac=ocxBRst79-gmdu8=6VTD6oPgdGT0rb_HaQ@mail.gmail.com' \
    --to=adam@piggz.co.uk \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.