diff mbox series

[BlueZ] adapter: Fix toggling of experimental features

Message ID 20210624220844.3920039-1-luiz.dentz@gmail.com (mailing list archive)
State New, archived
Headers show
Series [BlueZ] adapter: Fix toggling of experimental features | expand

Commit Message

Luiz Augusto von Dentz June 24, 2021, 10:08 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

When toggling experimental features it may cause the old value to still
be in effect since it was read after read info which upon completion
would attempt to call adapter_register without first updating the
experimental features which could affect the likes of advertising
instances when LL Privacy is enabled.
---
 src/adapter.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

bluez.test.bot@gmail.com June 24, 2021, 10:36 p.m. UTC | #1
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=506771

---Test result---

Test Summary:
CheckPatch                    PASS      0.41 seconds
GitLint                       PASS      0.11 seconds
Prep - Setup ELL              PASS      43.31 seconds
Build - Prep                  PASS      0.14 seconds
Build - Configure             PASS      7.61 seconds
Build - Make                  PASS      188.57 seconds
Make Check                    PASS      8.56 seconds
Make Distcheck                PASS      222.79 seconds
Build w/ext ELL - Configure   PASS      7.66 seconds
Build w/ext ELL - Make        PASS      177.18 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz June 28, 2021, 5:35 p.m. UTC | #2
Hi,

On Thu, Jun 24, 2021 at 3:36 PM <bluez.test.bot@gmail.com> wrote:
>
> 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=506771
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      0.41 seconds
> GitLint                       PASS      0.11 seconds
> Prep - Setup ELL              PASS      43.31 seconds
> Build - Prep                  PASS      0.14 seconds
> Build - Configure             PASS      7.61 seconds
> Build - Make                  PASS      188.57 seconds
> Make Check                    PASS      8.56 seconds
> Make Distcheck                PASS      222.79 seconds
> Build w/ext ELL - Configure   PASS      7.66 seconds
> Build w/ext ELL - Make        PASS      177.18 seconds
>
> Details
> ##############################
> Test: CheckPatch - PASS
> Desc: Run checkpatch.pl script with rule in .checkpatch.conf
>
> ##############################
> Test: GitLint - PASS
> Desc: Run gitlint with rule in .gitlint
>
> ##############################
> Test: Prep - Setup ELL - PASS
> Desc: Clone, build, and install ELL
>
> ##############################
> Test: Build - Prep - PASS
> Desc: Prepare environment for build
>
> ##############################
> Test: Build - Configure - PASS
> Desc: Configure the BlueZ source tree
>
> ##############################
> Test: Build - Make - PASS
> Desc: Build the BlueZ source tree
>
> ##############################
> Test: Make Check - PASS
> Desc: Run 'make check'
>
> ##############################
> Test: Make Distcheck - PASS
> Desc: Run distcheck to check the distribution
>
> ##############################
> Test: Build w/ext ELL - Configure - PASS
> Desc: Configure BlueZ source with '--enable-external-ell' configuration
>
> ##############################
> Test: Build w/ext ELL - Make - PASS
> Desc: Build BlueZ source with '--enable-external-ell' configuration
>
>
>
> ---
> Regards,
> Linux Bluetooth

Pushed.
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 2175120f4..84bc5a1b0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -9253,14 +9253,15 @@  static void set_exp_debug_complete(uint8_t status, uint16_t len,
 static void exp_debug_func(struct btd_adapter *adapter, uint32_t flags)
 {
 	struct mgmt_cp_set_exp_feature cp;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
 
-	/* If already enabled don't attempt to set it again */
-	if (flags & BIT(0))
+	/* If already set don't attempt to set it again */
+	if (action == (flags & BIT(0)))
 		return;
 
 	memset(&cp, 0, sizeof(cp));
 	memcpy(cp.uuid, debug_uuid, 16);
-	cp.action = 0x01;
+	cp.action = btd_opts.experimental ? 0x01 : 0x00;
 
 	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
 			adapter->dev_id, sizeof(cp), &cp,
@@ -9289,14 +9290,15 @@  static void set_rpa_resolution_complete(uint8_t status, uint16_t len,
 static void rpa_resolution_func(struct btd_adapter *adapter, uint32_t flags)
 {
 	struct mgmt_cp_set_exp_feature cp;
+	uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
 
-	/* If already enabled don't attempt to set it again */
-	if (flags & BIT(0))
+	/* If already set don't attempt to set it again */
+	if (action == (flags & BIT(0)))
 		return;
 
 	memset(&cp, 0, sizeof(cp));
 	memcpy(cp.uuid, rpa_resolution_uuid, 16);
-	cp.action = 0x01;
+	cp.action = action;
 
 	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
 			adapter->dev_id, sizeof(cp), &cp,
@@ -9480,10 +9482,6 @@  static void read_info_complete(uint8_t status, uint16_t length,
 			(missing_settings & MGMT_SETTING_FAST_CONNECTABLE))
 		set_mode(adapter, MGMT_OP_SET_FAST_CONNECTABLE, 0x01);
 
-	if (btd_opts.experimental &&
-			btd_has_kernel_features(KERNEL_EXP_FEATURES))
-		read_exp_features(adapter);
-
 	err = adapter_register(adapter);
 	if (err < 0) {
 		btd_error(adapter->dev_id, "Unable to register new adapter");
@@ -9707,6 +9705,9 @@  static void index_added(uint16_t index, uint16_t length, const void *param,
 		return;
 	}
 
+	if (btd_has_kernel_features(KERNEL_EXP_FEATURES))
+		read_exp_features(adapter);
+
 	/*
 	 * Protect against potential two executions of read controller info.
 	 *