]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:17:47 +0000 (10:17 +0200)
[ Upstream commit 127881334eaad639e0a19a399ee8c91d6c9dc982 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/bluetooth/hci.h
net/bluetooth/hci_sync.c

index be2aad0492b0d5dc21ab6137ce7570bc8fba0498..c26ce78040a3f813dde33be0d25541ebae330dd6 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 bb455e96a715aaecd2d3a48cc45462693c260294..cb4d47ae129e8bb88f3ec4989abeb6e7a8e7b763 100644 (file)
@@ -4156,7 +4156,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,