bluez_inc icon indicating copy to clipboard operation
bluez_inc copied to clipboard

multiple same services

Open robotdoly opened this issue 3 years ago • 2 comments

hi i want to create a hardware rev and software rev character to 'device info services', part of Bluetooth Base UUID (xxxxxxxx-0000-1000-8000-00805F9B34FB). i could advertise service with success, unfortunately there is multiple "Device Information" services on advertisement. I assume device already create a service based on "Device Information UUID" with "PnP ID" character.

According to google this Pnp id;" This interface represents the Pn PID GATT Characteristic with uuid 2A50. It is referenced by the DeviceInformation service."

So the problem is, due to double "DEVICE INFO" services characteristic not found on central side. App found "Device Service" based on UUID unfortunately this service contains only PnP ID character.

I could not find a solution to add hardware rev and software rev char to single Device Information Service, and i need help. Thank you.

robotdoly avatar Nov 01 '22 00:11 robotdoly

hi, yes I also noticed that. Bluez is automatically doing that and it is not caused by this library. However, I haven't figured out a way to solve it...

weliem avatar Nov 03 '22 20:11 weliem

ok, thanks for your answer. I am still digging.

robotdoly avatar Nov 03 '22 20:11 robotdoly

What an awesome library, thank you! I am running into this issue as well as I build a Polar H10 emulator. Occasionally my DIS using bluez_inc works, but it too frequently fails. I've tracked it down to the doubly-linked GList in binc_service_get_characteristic. (it seems) bluez inserts a 2a50 as the first and last element in the list, so any search not for 2a50 fails.

I inserted a number of log_debug statements adding func at the start--

FAILS (apparently using bluez auto-installed service/chars) DEBUG [Device] binc_device_get_characteristic: Found service 0000180a-0000-1000-8000-00805f9b34fb DEBUG [Service] binc_service_get_characteristic: Searching for characteristic <00002a26-0000-1000-8000-00805f9b34fb> DEBUG [Service] binc_service_get_characteristic: Found characteristic 00002a50-0000-1000-8000-00805f9b34fb DEBUG [Device] binc_device_read_char, service 0000180a-0000-1000-8000-00805f9b34fb, characteristic 00002a26-0000-1000-8000-00805f9b34fb, is null DEBUG [gymlink.c] on_services_resolved: (pi3dev) could not read characteristic 00002a26-0000-1000-8000-00805f9b34fb`

WORKS (same code, different run, iterates through the list properly apparently using my services/chars) DEBUG [Device] binc_device_get_characteristic: Found service 0000180a-0000-1000-8000-00805f9b34fb DEBUG [Service] binc_service_get_characteristic: Searching for characteristic <00002a26-0000-1000-8000-00805f9b34fb> DEBUG [Service] binc_service_get_characteristic: Found characteristic 00002a50-0000-1000-8000-00805f9b34fb DEBUG [Service] binc_service_get_characteristic: Found characteristic 00002a27-0000-1000-8000-00805f9b34fb DEBUG [Service] binc_service_get_characteristic: Found characteristic 00002a26-0000-1000-8000-00805f9b34fb DEBUG [Device] binc_device_read_char: service 0000180a-0000-1000-8000-00805f9b34fb, characteristic 00002a26-0000-1000-8000-00805f9b34fb, supports = 1 DEBUG [Characteristic] binc_characteristic_read: Reading characteristic <00002a26-0000-1000-8000-00805f9b34fb> DEBUG [gymlink.c] on_services_resolved: (pi3dev) Read characteristic 00002a26-0000-1000-8000-00805f9b34fb

I'll keep poking around. Is there a way to delete a characteristic (binc_service_delete_characteristic?) ? Alternately is there a way to remove the 0x180a service and reinstall at run time (binc_application_delete_service)? I'll keep poking around.

First time ever commenting--please correct any impertinence!

abqjln avatar Aug 19 '24 23:08 abqjln

SOLVED: Asked and answered. I think. Disable the auto-registering of DIS(0x180a) and PnP (0x2a50) under bluetoothctl: 5.66 https://github.com/bluez/bluez/issues/101

Tested lightly on Raspberry Pi 3 (peripheral) and 4 (central) bookworm 32 bit

Two mods to /etc/bluetooth/main.conf DeviceID=false Cache=no (probably not necessary but convenient when developing)

sudo systemctl daemon-reload sudo systemctl restart bluetooth sudo systemctl status bluetooth (or reboot)

abqjln avatar Aug 20 '24 00:08 abqjln

Ah great find. Will test this

weliem avatar Aug 20 '24 07:08 weliem

Works! Closing issue....

weliem avatar Aug 25 '24 08:08 weliem