emericg / toolBLEx

A multiplatform Bluetooth Low Energy (and Classic) device scanner and analyzer.
GNU General Public License v3.0
154 stars 14 forks source link

Very slow service discovery #17

Open parkerlreed opened 7 months ago

parkerlreed commented 7 months ago

Describe the bug

Connected to a Bluetooth tracker that supports Immediate Alert to beep. Clicking the expand on the service shows nothing.

Expected behavior

According to the example screenshots, should be drop down to read/write.

To Reproduce Steps to reproduce the behavior:

  1. Connect to device
  2. Click Services
  3. Click drop down next to service
  4. Nothing appears

Screenshots

Screenshot_20240306_143859 Screenshot_20240306_143916

Your environment Please describe the environment you are using:

  1. Steam OS 3.5 (Valve modified Arch Linux)
  2. Releases tar.gz
  3. 0.10
parkerlreed commented 7 months ago

As I was writing the issue it populated and works now. Is that process slow to load?

parkerlreed commented 7 months ago

Just relaunched and it took nearly 4 minutes to expand services.

parkerlreed commented 7 months ago

Does toolBLEx enumerate over all the characteristics? This tracker is slow to respond to a single query (upwards of 4 seconds). Maybe that 4 seconds is stacking with hundreds of calls? nrf Connect on Android seem to load the list fine so I'm not sure.

parkerlreed commented 7 months ago

After some more testing this does seem to be limited to this device, likely caused by a very low clocked/powered processor causing delayed responses. Even with the cache it seems to take the same 2-4 minutes each time to enumerate through everything and start interacting with services.

emericg commented 7 months ago

Hi,

Does toolBLEx enumerate over all the characteristics?

Yes it does. By default toolBLEx is not only scanning services and characteristics (that's kind of required anyway) but it pulls data from each readable characteristic. You can try a "simple" scan with the scan button drop down menu, where you can select what you want to do (services and data or services only). It should make a difference.

The cache is only used by the UI, it won't speed up subsequent connections to a device.

After some more testing this does seem to be limited to this device, likely caused by a very low clocked/powered processor causing delayed responses.

May I ask how many characteristics that device has?

nrf Connect on Android seem to load the list fine

I guess nrf connect doesn't pull data so it is faster in your case.

Reading data by default seems like a good choice for a Bluetooth analyzer, but maybe there should be an option to set the preferred choice.

parkerlreed commented 7 months ago

Here's the list from bluetoothctl

So yeah the slow response does seem to be the bottleneck with that many.

I agree reading values is great for analyzer defaults. An option to skip reading would indeed be great to have. Thank you!

[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0006
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0006/char0007
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0006/char0007/desc0009
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000a
        0000180f-0000-1000-8000-00805f9b34fb
        Battery Service
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000a/char000b
        00002a19-0000-1000-8000-00805f9b34fb
        Battery Level
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000a/char000b/desc000d
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e
        0000180a-0000-1000-8000-00805f9b34fb
        Device Information
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e/char000f
        00002a29-0000-1000-8000-00805f9b34fb
        Manufacturer Name String
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e/char0011
        00002a24-0000-1000-8000-00805f9b34fb
        Model Number String
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e/char0013
        00002a26-0000-1000-8000-00805f9b34fb
        Firmware Revision String
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e/char0015
        00002a28-0000-1000-8000-00805f9b34fb
        Software Revision String
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e/char0017
        00002a23-0000-1000-8000-00805f9b34fb
        System ID
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service000e/char0019
        00002a50-0000-1000-8000-00805f9b34fb
        PnP ID
[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b
        0000fef5-0000-1000-8000-00805f9b34fb
        Dialog Semiconductor GmbH
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char001c
        8082caa8-41a6-4021-91c6-56f9b954cc34
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char001e
        724249f0-5ec3-4b5f-8804-42345af08651
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char0020
        6c53db25-47a1-45fe-a022-7c92fb334fd4
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char0022
        9d84b9a3-000c-49d8-9183-855b673fda31
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char0024
        457871e8-d516-4ca1-9116-57d0b17b9cb2
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char0026
        5f78df94-798c-46f5-990a-b3eb6a065c88
        Vendor specific
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char0026/desc0028
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char0029
        64b4e8b5-0de5-401b-a21d-acc8db3b913a
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char002b
        42c3dfdd-77be-4d9c-8454-8f875267fb3b
        Vendor specific
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service001b/char002d
        b7de1eea-823d-43bb-a3af-c4903dfce23c
        Vendor specific
[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f
        0000aaa0-0000-1000-8000-00805f9b34fb
        Unknown
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0030
        00002a30-0000-1000-8000-00805f9b34fb
        Unknown
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0030/desc0032
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0033
        00002a31-0000-1000-8000-00805f9b34fb
        Scan Refresh
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0033/desc0035
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0036
        00002a15-0000-1000-8000-00805f9b34fb
        Unknown
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0036/desc0038
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0039
        00002a14-0000-1000-8000-00805f9b34fb
        Reference Time Information
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char0039/desc003b
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char003c
        00002a0f-0000-1000-8000-00805f9b34fb
        Local Time Information
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char003c/desc003e
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char003f
        00002a0d-0000-1000-8000-00805f9b34fb
        DST Offset
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service002f/char003f/desc0041
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0042
        00001802-0000-1000-8000-00805f9b34fb
        Immediate Alert
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0042/char0043
        00002a06-0000-1000-8000-00805f9b34fb
        Alert Level
[NEW] Descriptor (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0042/char0043/desc0045
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0046
        00001804-0000-1000-8000-00805f9b34fb
        Tx Power
[NEW] Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_74_F4_13_00_25_AD/service0046/char0047
        00002a07-0000-1000-8000-00805f9b34fb
        Tx Power Level
emericg commented 7 months ago

It doesn't look like that there are that many characteristics, maybe that's more about how much data must be pulled for each one of them (but that's not included in the cache at the moment).

Did you try a "services only" scan to see if reading the characteristics is the problem? The log panel has timestamps, it should let you see what is taking a long time.

I've added a bit more info so users can see if the services are still "discovering" or fully "discovered".

Capture d’écran du 2024-03-08 19-41-29

parkerlreed commented 7 months ago

Services Only discovery just took about 2 minutes.

Having that label looks great.

parkerlreed commented 6 months ago

Thanks! I can now see the discovery as it happens.

image