Skip to contentSkip to conversation

adapter: Fix unnecessarily enabling the connectable property.

PATCH In review Vibhav Pant 2 participants 3 messages Feb 14, 2025 – Feb 15, 2025 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

cover adapter: Fix unnecessarily enabling the connectable property.

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(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/1 adapter: Fix unnecessarily enabling the connectable property.

While enabling the discoverable property for an adapter, only enable the connectable property only if it is currently disabled.

---
 src/adapter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/adapter.c +3 -2
index da602a7b8..01ef0db5a 100644
@@ -3142,10 +3142,11 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 		break;
 	case MGMT_SETTING_DISCOVERABLE:
 		if (btd_has_kernel_features(KERNEL_CONN_CONTROL)) {
-			if (mode) {
+			if (mode && !(adapter->current_settings &
+				      MGMT_SETTING_CONNECTABLE)) {
 				set_mode(adapter, MGMT_OP_SET_CONNECTABLE,
 									mode);
-			} else {
+			} else if (!mode) {
 				opcode = MGMT_OP_SET_CONNECTABLE;
 				param = &mode;
 				len = sizeof(mode);
Signature · 1 line
2.48.1
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=934207

---Test result---

Test Summary:

CheckPatch                    PENDING   0.20 seconds
GitLint                       PENDING   0.20 seconds
BuildEll                      PASS      20.45 seconds
BluezMake                     PASS      1546.46 seconds
MakeCheck                     PASS      13.56 seconds
MakeDistcheck                 PASS      157.94 seconds
CheckValgrind                 PASS      214.45 seconds
CheckSmatch                   PASS      283.28 seconds
bluezmakeextell               PASS      97.91 seconds
IncrementalBuild              PENDING   0.27 seconds
ScanBuild                     PASS      855.36 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth