Skip to contentSkip to conversation

bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers

PATCH In review Pedro Nishiyama 3 participants 3 messages Feb 19, 2025 – Feb 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers

Set HCI_OP_READ_VOICE_SETTING and HCI_OP_READ_PAGE_SCAN_TYPE as broken. These features are falsely reported as supported.

https://bugzilla.kernel.org/show_bug.cgi?id=60824

---
 drivers/bluetooth/btusb.c   |  2 ++
 include/net/bluetooth/hci.h | 16 ++++++++++++++++
 net/bluetooth/hci_sync.c    |  6 ++++++
 3 files changed, 24 insertions(+)
drivers/bluetooth/btusb.c +2 -0
index 90966dfbd278..43403b0cb5cc 100644
@@ -2435,6 +2435,8 @@ static int btusb_setup_csr(struct hci_dev *hdev)
 		set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
 		set_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks);
 		set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_READ_VOICE_SETTING, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE, &hdev->quirks);
 
 		/* Clear the reset quirk since this is not an actual
 		 * early Bluetooth 1.1 device from CSR.
include/net/bluetooth/hci.h +16 -0
index 0d51970d809f..b99818df8ee7 100644
@@ -354,6 +354,22 @@ enum {
 	 * during the hdev->setup vendor callback.
 	 */
 	HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY,
+
+	/* When this quirk is set, the HCI_OP_READ_VOICE_SETTING command is
+	 * skipped. This is required for a subset of the CSR controller clones
+	 * which erroneously claim to support it.
+	 *
+	 * This quirk must be set before hci_register_dev is called.
+	 */
+	HCI_QUIRK_BROKEN_READ_VOICE_SETTING,
+
+	/* When this quirk is set, the HCI_OP_READ_PAGE_SCAN_TYPE command is
+	 * skipped. This is required for a subset of the CSR controller clones
+	 * which erroneously claim to support it.
+	 *
+	 * This quirk must be set before hci_register_dev is called.
+	 */
+	HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE,
 };
 
 /* HCI device flags */
net/bluetooth/hci_sync.c +6 -0
index dd770ef5ec36..e76012956020 100644
@@ -3696,6 +3696,9 @@ static int hci_read_local_name_sync(struct hci_dev *hdev)
 /* Read Voice Setting */
 static int hci_read_voice_setting_sync(struct hci_dev *hdev)
 {
+	if (test_bit(HCI_QUIRK_BROKEN_READ_VOICE_SETTING, &hdev->quirks))
+		return 0;
+
 	return __hci_cmd_sync_status(hdev, HCI_OP_READ_VOICE_SETTING,
 				     0, NULL, HCI_CMD_TIMEOUT);
 }
@@ -4132,6 +4135,9 @@ static int hci_read_page_scan_type_sync(struct hci_dev *hdev)
 	if (!(hdev->commands[13] & 0x01))
 		return 0;
 
+	if (test_bit(HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE, &hdev->quirks))
+		return 0;
+
 	return __hci_cmd_sync_status(hdev, HCI_OP_READ_PAGE_SCAN_TYPE,
 				     0, NULL, HCI_CMD_TIMEOUT);
 }
Signature · 1 line
2.48.1
#1 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=935756

---Test result---

Test Summary:

CheckPatch                    PENDING   0.33 seconds
GitLint                       PENDING   0.20 seconds
SubjectPrefix                 FAIL      4.19 seconds
BuildKernel                   PASS      24.41 seconds
CheckAllWarning               PASS      26.56 seconds
CheckSparse                   PASS      30.47 seconds
BuildKernel32                 PASS      23.82 seconds
TestRunnerSetup               PASS      427.42 seconds
TestRunner_l2cap-tester       PASS      24.18 seconds
TestRunner_iso-tester         PASS      34.97 seconds
TestRunner_bnep-tester        PASS      4.74 seconds
TestRunner_mgmt-tester        FAIL      119.57 seconds
TestRunner_rfcomm-tester      PASS      7.78 seconds
TestRunner_sco-tester         PASS      9.62 seconds
TestRunner_ioctl-tester       PASS      8.36 seconds
TestRunner_mesh-tester        PASS      5.82 seconds
TestRunner_smp-tester         PASS      7.23 seconds
TestRunner_userchan-tester    PASS      5.04 seconds
IncrementalBuild              PENDING   0.68 seconds

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

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

##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix Output:
"Bluetooth: " prefix is not specified in the subject
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
LL Privacy - Set Flags 3 (2 Devices to RL) Failed 0.167 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Pedro Nishiyama

Hi Pedro,

Quoted 5 lines · Pedro Nishiyama

Set HCI_OP_READ_VOICE_SETTING and HCI_OP_READ_PAGE_SCAN_TYPE as broken. These features are falsely reported as supported.

https://bugzilla.kernel.org/show_bug.cgi?id=60824

If it is a regression it needs the Fixes tag of the change when the regression was introduced in order to determine if it should be backported, etc.

Quoted 12 lines
---
 drivers/bluetooth/btusb.c   |  2 ++
 include/net/bluetooth/hci.h | 16 ++++++++++++++++
 net/bluetooth/hci_sync.c    |  6 ++++++
 3 files changed, 24 insertions(+)
drivers/bluetooth/btusb.c +0 -0
index 90966dfbd278..43403b0cb5cc 100644

drivers/bluetooth/btusb.c static int btusb_setup_csr(struct hci_dev *hdev) · line 2439

Quoted 5 lines
drivers/bluetooth/btusb.c +2 -0
@@ -2435,6 +2435,8 @@ static int btusb_setup_csr(struct hci_dev *hdev)
                set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
                set_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks);
                set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks);
+               set_bit(HCI_QUIRK_BROKEN_READ_VOICE_SETTING, &hdev->quirks);
+               set_bit(HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE, &hdev->quirks);

Can you please split the driver specific changes from the quirks?

Quoted 56 lines
drivers/bluetooth/btusb.c +0 -0
                /* Clear the reset quirk since this is not an actual
                 * early Bluetooth 1.1 device from CSR.
include/net/bluetooth/hci.h +16 -0
index 0d51970d809f..b99818df8ee7 100644
@@ -354,6 +354,22 @@ enum {
         * during the hdev->setup vendor callback.
         */
        HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY,
+
+       /* When this quirk is set, the HCI_OP_READ_VOICE_SETTING command is
+        * skipped. This is required for a subset of the CSR controller clones
+        * which erroneously claim to support it.
+        *
+        * This quirk must be set before hci_register_dev is called.
+        */
+       HCI_QUIRK_BROKEN_READ_VOICE_SETTING,
+
+       /* When this quirk is set, the HCI_OP_READ_PAGE_SCAN_TYPE command is
+        * skipped. This is required for a subset of the CSR controller clones
+        * which erroneously claim to support it.
+        *
+        * This quirk must be set before hci_register_dev is called.
+        */
+       HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE,
 };
 
 /* HCI device flags */
net/bluetooth/hci_sync.c +6 -1
index dd770ef5ec36..e76012956020 100644
@@ -3696,6 +3696,9 @@ static int hci_read_local_name_sync(struct hci_dev *hdev)
 /* Read Voice Setting */
 static int hci_read_voice_setting_sync(struct hci_dev *hdev)
 {
+       if (test_bit(HCI_QUIRK_BROKEN_READ_VOICE_SETTING, &hdev->quirks))
+               return 0;
+
        return __hci_cmd_sync_status(hdev, HCI_OP_READ_VOICE_SETTING,
                                     0, NULL, HCI_CMD_TIMEOUT);
 }
@@ -4132,6 +4135,9 @@ static int hci_read_page_scan_type_sync(struct hci_dev *hdev)
        if (!(hdev->commands[13] & 0x01))
                return 0;
 
+       if (test_bit(HCI_QUIRK_BROKEN_READ_PAGE_SCAN_TYPE, &hdev->quirks))
+               return 0;
+
        return __hci_cmd_sync_status(hdev, HCI_OP_READ_PAGE_SCAN_TYPE,
                                     0, NULL, HCI_CMD_TIMEOUT);
 }
--

2.48.1

Signature · 1 line
Luiz Augusto von Dentz