bluetoothctl select-attribute fails when passed a UUID
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bluez Utilities |
New
|
Undecided
|
Unassigned |
Bug Description
The UUID-based attribute selection does not respect the connected device's MAC address.
If you have two identical bluetooth devices A, B with different MAC addresses, and you use bluetoothctl to first connect to A, disconnect, and then connect to B, then it will fail to select the proper UUID for any of unit B.
For illustration, assume the MAC address of device A is AA:AA:AA:AA:AA:AA, and device B is BB:BB:BB:BB:BB:BB, the following commands would produce the issue:
#######
service bluetooth restart
# Execute the following in bluetoothctl:
bluetoothctl
connect AA:AA:AA:AA:AA:AA
disconnect
connect BB:BB:BB:BB:BB:BB
menu gatt
attribute-info abd23151-
Characteristic - Vendor specific
UUID: abd23151-
Service: /org/bluez/
Flags: read
MTU: 0x00f7
#######
See above? Even though I have connected to device B, and then selected its characteristic via UUID, the attribute returned is actually that of device A!
I can workaround the issue by using a different syntax:
#######
bluetoothctl
connect AA:AA:AA:AA:AA:AA
disconnect
connect BB:BB:BB:BB:BB:BB
menu gatt
attribute-info /org/bluez/
Characteristic - Vendor specific
UUID: abd23151-
Service: /org/bluez/
Flags: read
MTU: 0x00f7
#######
$ bluetoothctl --version
bluetoothctl: 5.64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy