mbox series

[BlueZ,0/1] adapter: Fix unnecessarily enabling the connectable property.

Message ID 20250214224149.135458-1-vibhavp@gmail.com (mailing list archive)
Headers show
Series adapter: Fix unnecessarily enabling the connectable property. | expand

Message

Vibhav Pant Feb. 14, 2025, 10:41 p.m. UTC
Hello,
As the Connectable and Discoverable properties for an adapter can now be set independently, this creates an issue where if Connectable is set to true before setting Discoverable to true as well, property_set_mode will still try to set connectability to true, resulting in any future attempts to set Connectable failing with org.bluez.Error.Busy, as the adapter's pending_setting bitmask (specifically, MGMT_SETTING_CONNECTABLE) never gets cleared.
This can be reproduced by the following commands:

busctl set-property org.bluez /org/bluez/hci0 org.bluez.Adapter1 Connectable b true
busctl set-property org.bluez /org/bluez/hci0 org.bluez.Adapter1 Discoverable b true
busctl set-property org.bluez /org/bluez/hci0 org.bluez.Adapter1 Connectable b false

This patch fixes property_set_mode to only set connectable while enabling discoverability if it is currently disabled for the adapter.

Thanks,
Vibhav

Vibhav Pant (1):
  adapter: Fix unnecessarily enabling the connectable property.

 src/adapter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)