Re: Battery1 vs. GATT reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <beroset@xxxxxxxxxxxxxx> 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
>



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux