]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Bluetooth: Add quirk for broken READ_PAGE_SCAN_TYPE
authorPedro Nishiyama <nishiyama.pedro@gmail.com>
Sat, 1 Mar 2025 06:22:59 +0000 (03:22 -0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 25 Mar 2025 16:43:51 +0000 (12:43 -0400)
Some fake controllers cannot be initialized because they return a smaller
report than expected for READ_PAGE_SCAN_TYPE.

Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
include/net/bluetooth/hci.h
net/bluetooth/hci_sync.c

index 295d97e312e1d260490a1024cfea59b3c8e46b46..aa684d2b079fabb80e0da1501101b24651e89f84 100644 (file)
@@ -362,6 +362,14 @@ enum {
         * 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 */
index fd07858387600f9a637ab0b3fa7bbda146171f8f..c4c2cf51b219ca5281b75d2b7b6a90d01f0e7c10 100644 (file)
@@ -4132,7 +4132,8 @@ static int hci_read_page_scan_type_sync(struct hci_dev *hdev)
         * support the Read Page Scan Type command. Check support for
         * this command in the bit mask of supported commands.
         */
-       if (!(hdev->commands[13] & 0x01))
+       if (!(hdev->commands[13] & 0x01) ||
+           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,