2022-02-28 17:45:31

by Ed Beroset

[permalink] [raw]
Subject: Battery1 vs. GATT reporting

In
https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=713f6f09 a
flag named "external" was added which, if I'm understanding correctly,
is supposed to mark the Battery1 profile as safe to also share via GATT.
However, I was recently working on an application that relies on the
GATT API for battery power and found that it only seemed to work as
expected (reporting via both) if I set the flag to false rather than
true as in the commit. I looked through the code and it all looks
correct, but my observation indicates that perhaps the sense of the flag
is somehow inverted.

Here's the project I was working on, with the relevant bug report.
https://github.com/AsteroidOS/libasteroid/issues/13

So can someone verify that:
1. the interface is intended to be shared via GATT and Battery1
2. that it does not work that way today

Ed


2022-02-28 19:49:53

by Sonny Sasaka

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

Hi Ed,

Your understanding is correct about the purpose of that flag. So I can
confirm that (1) is true. For (2), I can confirm otherwise, since I am
able to get both battery values from GATT API and Battery1 API. Here
is my output:

```
// pair and connect to an LE device with battery service first (e.g an LE Mouse)
// [bluetoothctl]# gatt.list-attributes
// [bluetoothctl]# gatt.select-attribute
/org/bluez/hci0/dev_C6_XX/service000e/char000f

// via GATT API
[BluetoothMouse3600:/service000e/char000f]# gatt.read
Attempting to read /org/bluez/hci0/dev_C6_XX/service000e/char000f
[CHG] Attribute /org/bluez/hci0/dev_C6_XX/service000e/char000f Value:
4d M
4d M

// via Battery API
[BluetoothMouse3600:/service000e/char000f]# info
Device C6:XX (random)
Name: BluetoothMouse3600
Alias: BluetoothMouse3600
...
Battery Percentage: 0x4e (78)
[BluetoothMouse3600:/service000e/char000f]#
```

Could you try the same with bluetoothctl and share the output?

On Mon, Feb 28, 2022 at 6:20 AM Ed Beroset <[email protected]> wrote:
>
> In
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=713f6f09 a
> flag named "external" was added which, if I'm understanding correctly,
> is supposed to mark the Battery1 profile as safe to also share via GATT.
> However, I was recently working on an application that relies on the
> GATT API for battery power and found that it only seemed to work as
> expected (reporting via both) if I set the flag to false rather than
> true as in the commit. I looked through the code and it all looks
> correct, but my observation indicates that perhaps the sense of the flag
> is somehow inverted.
>
> Here's the project I was working on, with the relevant bug report.
> https://github.com/AsteroidOS/libasteroid/issues/13
>
> So can someone verify that:
> 1. the interface is intended to be shared via GATT and Battery1
> 2. that it does not work that way today
>
> Ed
>

2022-02-28 19:51:23

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

Hi Ed,

On Mon, Feb 28, 2022 at 9:45 AM Ed Beroset <[email protected]> wrote:
>
> In
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=713f6f09 a
> flag named "external" was added which, if I'm understanding correctly,
> is supposed to mark the Battery1 profile as safe to also share via GATT.
> However, I was recently working on an application that relies on the
> GATT API for battery power and found that it only seemed to work as
> expected (reporting via both) if I set the flag to false rather than
> true as in the commit. I looked through the code and it all looks
> correct, but my observation indicates that perhaps the sense of the flag
> is somehow inverted.
>
> Here's the project I was working on, with the relevant bug report.
> https://github.com/AsteroidOS/libasteroid/issues/13
>
> So can someone verify that:
> 1. the interface is intended to be shared via GATT and Battery1
> 2. that it does not work that way today

Did you check if that was not fixed already? It seems to work alright
with git latest using bluetoothctl:

[NEW] Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/service0020
0000180f-0000-1000-8000-00805f9b34fb
Battery Service


--
Luiz Augusto von Dentz

2022-03-01 17:14:41

by Ed Beroset

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

On 3/1/22 10:43, Sonny Sasaka wrote:
> Hi Ed,
>
> What I do is call `gatt.select-attribute` on the characteristic called
> "Battery Level", but it is not shown in your case. So maybe this is
> the bug that you are encountering. What is the exact version of your
> BlueZ (commit sha if possible)? Could you also try tip of tree to see
> if this is already fixed?

Hi Sonny,

I'm sorry, I should have noted that this is with the tip of tree, commit
bf09e1f048. Thanks for your help with this!

Ed

2022-03-01 17:50:39

by Ed Beroset

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

On 2/28/22 13:31, Sonny Sasaka wrote:
> Hi Ed,
>
> Your understanding is correct about the purpose of that flag. So I can
> confirm that (1) is true. For (2), I can confirm otherwise, since I am
> able to get both battery values from GATT API and Battery1 API. Here
> is my output:
>
> ```
> // pair and connect to an LE device with battery service first (e.g an LE Mouse)
> // [bluetoothctl]# gatt.list-attributes
> // [bluetoothctl]# gatt.select-attribute
> /org/bluez/hci0/dev_C6_XX/service000e/char000f
>
> // via GATT API
> [BluetoothMouse3600:/service000e/char000f]# gatt.read
> Attempting to read /org/bluez/hci0/dev_C6_XX/service000e/char000f
> [CHG] Attribute /org/bluez/hci0/dev_C6_XX/service000e/char000f Value:
> 4d M
> 4d M
>
> // via Battery API
> [BluetoothMouse3600:/service000e/char000f]# info
> Device C6:XX (random)
> Name: BluetoothMouse3600
> Alias: BluetoothMouse3600
> ...
> Battery Percentage: 0x4e (78)
> [BluetoothMouse3600:/service000e/char000f]#
> ```
>
> Could you try the same with bluetoothctl and share the output?

I'm not very sure of how to use bluetoothctl (no man page and I wasn't
able to find a lot in my searches on the internet) but what I did was to
pair and list the attributes using gatt.list-attributes, but I didn't
find anything that I could identify as a battery service or battery
attribute. I looked for 180f or 2a19 and found neither:

turgeon]# gatt.list-attributes 43:43:A0:12:1F:AC
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0049
00005071-0000-0000-0000-00a57e401d05
Vendor specific
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0049/char004a
00005001-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0049/char004a/desc004c
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041
00006071-0000-0000-0000-00a57e401d05
Vendor specific
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0045
00006002-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0045/desc0048
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0045/desc0047
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0042
00006001-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0042/desc0044
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029
00007071-0000-0000-0000-00a57e401d05
Vendor specific
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0039
00007006-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0039/desc003b
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0036
00007005-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0036/desc0038
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0033
00007004-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0033/desc0035
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0030
00007003-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0030/desc0032
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002d
00007002-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002d/desc002f
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002a
00007001-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002a/desc002c
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c
00008071-0000-0000-0000-00a57e401d05
Vendor specific
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0026
00008003-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0026/desc0028
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0023
00008004-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0023/desc0025
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0020
00008002-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0020/desc0022
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char001d
00008001-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char001d/desc001f
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015
00009071-0000-0000-0000-00a57e401d05
Vendor specific
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0019
00009002-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0019/desc001b
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0016
00009001-0000-0000-0000-00a57e401d05
Vendor specific
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0016/desc0018
00002900-0000-1000-8000-00805f9b34fb
Characteristic Extended Properties
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0012
0000180a-0000-1000-8000-00805f9b34fb
Device Information
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0012/char0013
00002a50-0000-1000-8000-00805f9b34fb
PnP ID
Primary Service (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char000e
00002b3a-0000-1000-8000-00805f9b34fb
Server Supported Features
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char000c
00002b29-0000-1000-8000-00805f9b34fb
Client Supported Features
Characteristic (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char0009
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
Descriptor (Handle 0x0000)
/org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char0009/desc000b
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration

However when I try info, it correctly reports both the battery service
and the battery percentage

Battery Percentage: 0x2b (43)

So I'm not sure how to make the step from gatt.list-attributes to
gatt.select-attributes. Any guidance?

Ed

2022-03-02 02:29:37

by Sonny Sasaka

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

Hi Ed,

What I do is call `gatt.select-attribute` on the characteristic called
"Battery Level", but it is not shown in your case. So maybe this is
the bug that you are encountering. What is the exact version of your
BlueZ (commit sha if possible)? Could you also try tip of tree to see
if this is already fixed?

On Tue, Mar 1, 2022 at 6:32 AM Ed Beroset <[email protected]> wrote:
>
> On 2/28/22 13:31, Sonny Sasaka wrote:
> > Hi Ed,
> >
> > Your understanding is correct about the purpose of that flag. So I can
> > confirm that (1) is true. For (2), I can confirm otherwise, since I am
> > able to get both battery values from GATT API and Battery1 API. Here
> > is my output:
> >
> > ```
> > // pair and connect to an LE device with battery service first (e.g an LE Mouse)
> > // [bluetoothctl]# gatt.list-attributes
> > // [bluetoothctl]# gatt.select-attribute
> > /org/bluez/hci0/dev_C6_XX/service000e/char000f
> >
> > // via GATT API
> > [BluetoothMouse3600:/service000e/char000f]# gatt.read
> > Attempting to read /org/bluez/hci0/dev_C6_XX/service000e/char000f
> > [CHG] Attribute /org/bluez/hci0/dev_C6_XX/service000e/char000f Value:
> > 4d M
> > 4d M
> >
> > // via Battery API
> > [BluetoothMouse3600:/service000e/char000f]# info
> > Device C6:XX (random)
> > Name: BluetoothMouse3600
> > Alias: BluetoothMouse3600
> > ...
> > Battery Percentage: 0x4e (78)
> > [BluetoothMouse3600:/service000e/char000f]#
> > ```
> >
> > Could you try the same with bluetoothctl and share the output?
>
> I'm not very sure of how to use bluetoothctl (no man page and I wasn't
> able to find a lot in my searches on the internet) but what I did was to
> pair and list the attributes using gatt.list-attributes, but I didn't
> find anything that I could identify as a battery service or battery
> attribute. I looked for 180f or 2a19 and found neither:
>
> [sturgeon] # gatt.list-attributes 43:43:A0:12:1F:AC
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0049
> 00005071-0000-0000-0000-00a57e401d05
> Vendor specific
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0049/char004a
> 00005001-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0049/char004a/desc004c
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041
> 00006071-0000-0000-0000-00a57e401d05
> Vendor specific
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0045
> 00006002-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0045/desc0048
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0045/desc0047
> 00002902-0000-1000-8000-00805f9b34fb
> Client Characteristic Configuration
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0042
> 00006001-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0041/char0042/desc0044
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029
> 00007071-0000-0000-0000-00a57e401d05
> Vendor specific
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0039
> 00007006-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0039/desc003b
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0036
> 00007005-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0036/desc0038
> 00002902-0000-1000-8000-00805f9b34fb
> Client Characteristic Configuration
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0033
> 00007004-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0033/desc0035
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0030
> 00007003-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char0030/desc0032
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002d
> 00007002-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002d/desc002f
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002a
> 00007001-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0029/char002a/desc002c
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c
> 00008071-0000-0000-0000-00a57e401d05
> Vendor specific
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0026
> 00008003-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0026/desc0028
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0023
> 00008004-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0023/desc0025
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0020
> 00008002-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char0020/desc0022
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char001d
> 00008001-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service001c/char001d/desc001f
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015
> 00009071-0000-0000-0000-00a57e401d05
> Vendor specific
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0019
> 00009002-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0019/desc001b
> 00002902-0000-1000-8000-00805f9b34fb
> Client Characteristic Configuration
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0016
> 00009001-0000-0000-0000-00a57e401d05
> Vendor specific
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0015/char0016/desc0018
> 00002900-0000-1000-8000-00805f9b34fb
> Characteristic Extended Properties
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0012
> 0000180a-0000-1000-8000-00805f9b34fb
> Device Information
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0012/char0013
> 00002a50-0000-1000-8000-00805f9b34fb
> PnP ID
> Primary Service (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008
> 00001801-0000-1000-8000-00805f9b34fb
> Generic Attribute Profile
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char000e
> 00002b3a-0000-1000-8000-00805f9b34fb
> Server Supported Features
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char000c
> 00002b29-0000-1000-8000-00805f9b34fb
> Client Supported Features
> Characteristic (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char0009
> 00002a05-0000-1000-8000-00805f9b34fb
> Service Changed
> Descriptor (Handle 0x0000)
> /org/bluez/hci0/dev_43_43_A0_12_1F_AC/service0008/char0009/desc000b
> 00002902-0000-1000-8000-00805f9b34fb
> Client Characteristic Configuration
>
> However when I try info, it correctly reports both the battery service
> and the battery percentage
>
> Battery Percentage: 0x2b (43)
>
> So I'm not sure how to make the step from gatt.list-attributes to
> gatt.select-attributes. Any guidance?
>
> Ed
>

2022-03-02 23:49:40

by Ed Beroset

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

On 3/1/22 11:01, Ed Beroset wrote:
> On 3/1/22 10:43, Sonny Sasaka wrote:
>> Hi Ed,
>>
>> What I do is call `gatt.select-attribute` on the characteristic called
>> "Battery Level", but it is not shown in your case. So maybe this is
>> the bug that you are encountering. What is the exact version of your
>> BlueZ (commit sha if possible)? Could you also try tip of tree to see
>> if this is already fixed?
>
> Hi Sonny,
>
> I'm sorry, I should have noted that this is with the tip of tree, commit
> bf09e1f048.  Thanks for your help with this!

I am trying this from a different computer today and I find that now the
Battery Service and Battery Level characteristic are showing up, even on
the same devices I was reading the other day. Not sure what's going on,
but I am investigating further. At the moment, it seems more likely
that the problem is either with my devices or with my software. I just
wanted to report back to avoid having you all waste your time. When I
figure this out, I'll send another update. Thanks for the help so far.

Ed

2022-05-18 03:40:06

by Sonny Sasaka

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

Thanks for circling back, I appreciate it!


On Tue, May 17, 2022 at 2:24 PM Ed Beroset <[email protected]> wrote:
>
> On 3/2/22 10:33, Ed Beroset wrote:
> > On 3/1/22 11:01, Ed Beroset wrote:
> >> On 3/1/22 10:43, Sonny Sasaka wrote:
> >>> Hi Ed,
> >>>
> >>> What I do is call `gatt.select-attribute` on the characteristic called
> >>> "Battery Level", but it is not shown in your case. So maybe this is
> >>> the bug that you are encountering. What is the exact version of your
> >>> BlueZ (commit sha if possible)? Could you also try tip of tree to see
> >>> if this is already fixed?
> >>
> >> Hi Sonny,
> >>
> >> I'm sorry, I should have noted that this is with the tip of tree,
> >> commit bf09e1f048. Thanks for your help with this!
> >
> > I am trying this from a different computer today and I find that now the
> > Battery Service and Battery Level characteristic are showing up, even on
> > the same devices I was reading the other day. Not sure what's going on,
> > but I am investigating further. At the moment, it seems more likely
> > that the problem is either with my devices or with my software. I just
> > wanted to report back to avoid having you all waste your time. When I
> > figure this out, I'll send another update. Thanks for the help so far.
>
> OK, it's been a while, but the problem was eventually tracked not to
> BlueZ but a Qt component I was using. Essentially, changes in BlueZ
> were being tracked by changes in Qt, but there was a problem with the Qt
> implementation starting with BlueZ version 5.55. No change required in
> BlueZ, and already fixed in Qt, but I thought I'd circle back around and
> let you all know the resolution.
>
> https://bugreports.qt.io/browse/QTBUG-70222
>
> Ed

2022-05-18 04:37:19

by Ed Beroset

[permalink] [raw]
Subject: Re: Battery1 vs. GATT reporting

On 3/2/22 10:33, Ed Beroset wrote:
> On 3/1/22 11:01, Ed Beroset wrote:
>> On 3/1/22 10:43, Sonny Sasaka wrote:
>>> Hi Ed,
>>>
>>> What I do is call `gatt.select-attribute` on the characteristic called
>>> "Battery Level", but it is not shown in your case. So maybe this is
>>> the bug that you are encountering. What is the exact version of your
>>> BlueZ (commit sha if possible)? Could you also try tip of tree to see
>>> if this is already fixed?
>>
>> Hi Sonny,
>>
>> I'm sorry, I should have noted that this is with the tip of tree,
>> commit bf09e1f048.  Thanks for your help with this!
>
> I am trying this from a different computer today and I find that now the
> Battery Service and Battery Level characteristic are showing up, even on
> the same devices I was reading the other day.  Not sure what's going on,
> but I am investigating further.  At the moment, it seems more likely
> that the problem is either with my devices or with my software.  I just
> wanted to report back to avoid having you all waste your time.  When I
> figure this out, I'll send another update.  Thanks for the help so far.

OK, it's been a while, but the problem was eventually tracked not to
BlueZ but a Qt component I was using. Essentially, changes in BlueZ
were being tracked by changes in Qt, but there was a problem with the Qt
implementation starting with BlueZ version 5.55. No change required in
BlueZ, and already fixed in Qt, but I thought I'd circle back around and
let you all know the resolution.

https://bugreports.qt.io/browse/QTBUG-70222

Ed