Skip to contentSkip to conversation

adapter: Fix not using the correct setting

PATCH In review Luiz Augusto von Dentz 3 participants 6 messages Mar 4, 2021 – Mar 6, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 adapter: Fix not using the correct setting

From: Luiz Augusto von Dentz <[email protected]>

set_mode shall use opcode to identify what setting are being changed rather then the mode.

---
 src/adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/adapter.c +1 -1
index 051c32753..f483cc827 100644
@@ -631,7 +631,7 @@ static bool set_mode(struct btd_adapter *adapter, uint16_t opcode,
 	memset(&cp, 0, sizeof(cp));
 	cp.val = mode;
 
-	switch (mode) {
+	switch (opcode) {
 	case MGMT_OP_SET_POWERED:
 		setting = MGMT_SETTING_POWERED;
 		break;
Signature · 1 line
2.29.2
author maintainer
#1 lore raw

PATCH 2/2 adapter: Return Busy error when setting is pending

From: Luiz Augusto von Dentz <[email protected]>

This returns an error if application attempts to change a property that is pending.

---
 src/adapter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
src/adapter.c +7 -1
index f483cc827..cc0849f99 100644
@@ -2880,12 +2880,18 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 
 	dbus_message_iter_get_basic(value, &enable);
 
+	if (adapter->pending_settings & setting) {
+		g_dbus_pending_property_error(id, ERROR_INTERFACE ".Busy",
+						NULL);
+		return;
+	}
+
 	if (adapter->current_settings & setting)
 		current_enable = TRUE;
 	else
 		current_enable = FALSE;
 
-	if (enable == current_enable || adapter->pending_settings & setting) {
+	if (enable == current_enable) {
 		g_dbus_pending_property_success(id);
 		return;
 	}
Signature · 1 line
2.29.2
#2 lore raw
In reply to Luiz Augusto von Dentz

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=442263

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

author maintainer Applied
#3 lore raw

Hi,

Quoted 20 lines · On Thu, Mar 4, 2021 at 2:38 PM <[email protected]> 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=442263

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

Quoted 8 lines

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

Applied.

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw
Quoted 30 lines · Luiz Augusto von Dentz

Hi,

Quoted 27 lines · On Thu, Mar 4, 2021 at 2:38 PM <[email protected]> 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=442263

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS

Quoted 5 lines
Quoted 3 lines

---
Regards,
Linux Bluetooth

Applied.

You didn't reply to my question about the patch.

I can't wait until we don't have to use mailing-lists to submit patches.

Sigh.

#5 lore raw
In reply to Luiz Augusto von Dentz
Quoted 4 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

set_mode shall use opcode to identify what setting are being changed rather then the mode.

What was the symptom of this bug?

Quoted 18 lines

---
 src/adapter.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
src/adapter.c +0 -0
index 051c32753..f483cc827 100644
@@ -631,7 +631,7 @@ static bool set_mode(struct btd_adapter *adapter,
 uint16_t opcode,
         memset(&cp, 0, sizeof(cp));
         cp.val = mode;


-       switch (mode) {
+       switch (opcode) {
        case MGMT_OP_SET_POWERED:
                setting = MGMT_SETTING_POWERED;
                break;