public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* RE: bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers
  2025-02-19 21:53 [PATCH] bluetooth: " Pedro Nishiyama
@ 2025-02-19 22:31 ` bluez.test.bot
  0 siblings, 0 replies; 11+ messages in thread
From: bluez.test.bot @ 2025-02-19 22:31 UTC (permalink / raw)
  To: linux-bluetooth, nishiyama.pedro

[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [V3 0/2] Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers
@ 2025-02-24 20:54 Pedro Nishiyama
  2025-02-24 20:54 ` [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles Pedro Nishiyama
  2025-02-24 20:54 ` [V3 2/2] " Pedro Nishiyama
  0 siblings, 2 replies; 11+ messages in thread
From: Pedro Nishiyama @ 2025-02-24 20:54 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Johan Hedberg,
	Pedro Nishiyama

These fake controllers cannot be initialized because they return a smaller 
report than expected for HCI_READ_VOICE_SETTING and HCI_READ_PAGE_SCAN_TYPE.

This affects fake controllers reusing the 0A12:0001 VID/PID.

Fixes: c8992cffbe74 ("Bluetooth: hci_event: Use of a function table to handle Command Complete")
Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
---
Changes in v3:
- Correct the fixes commit. 

Changes in v2:
- Separate the driver changes from the quirks changes.

---
Pedro Nishiyama (2):
  Bluetooth: Add new quirks for fake Bluetooth dongles
  Bluetooth: btusb: Fix regression in the initialization of fake
    Bluetooth controllers

 drivers/bluetooth/btusb.c   |  2 ++
 include/net/bluetooth/hci.h | 16 ++++++++++++++++
 net/bluetooth/hci_sync.c    |  6 ++++++
 3 files changed, 24 insertions(+)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles
  2025-02-24 20:54 [V3 0/2] Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers Pedro Nishiyama
@ 2025-02-24 20:54 ` Pedro Nishiyama
  2025-02-24 21:36   ` Luiz Augusto von Dentz
  2025-02-24 21:41   ` Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers bluez.test.bot
  2025-02-24 20:54 ` [V3 2/2] " Pedro Nishiyama
  1 sibling, 2 replies; 11+ messages in thread
From: Pedro Nishiyama @ 2025-02-24 20:54 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Johan Hedberg,
	Pedro Nishiyama

This adds quirks for broken READ_VOICE_SETTING and READ_PAGE_SCAN_TYPE.

Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
---
 include/net/bluetooth/hci.h | 16 ++++++++++++++++
 net/bluetooth/hci_sync.c    |  6 ++++++
 2 files changed, 22 insertions(+)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 0d51970d809f..b99818df8ee7 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -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 */
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index dd770ef5ec36..e76012956020 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [V3 2/2] Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers
  2025-02-24 20:54 [V3 0/2] Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers Pedro Nishiyama
  2025-02-24 20:54 ` [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles Pedro Nishiyama
@ 2025-02-24 20:54 ` Pedro Nishiyama
  1 sibling, 0 replies; 11+ messages in thread
From: Pedro Nishiyama @ 2025-02-24 20:54 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Johan Hedberg,
	Pedro Nishiyama

Set HCI_READ_VOICE_SETTING and HCI_READ_PAGE_SCAN_TYPE as broken.

Once the min/max length of the commands began to be asserted, these fake controllers
cannot be initialized because they return a smaller report than expected.
This affects fake controllers reusing the 0A12:0001 VID/PID.

Fixes: c8992cffbe74 ("Bluetooth: hci_event: Use of a function table to handle Command Complete")
Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
---
 drivers/bluetooth/btusb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8149e53fd0a7..903361456acf 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2436,6 +2436,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.
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles
  2025-02-24 20:54 ` [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles Pedro Nishiyama
@ 2025-02-24 21:36   ` Luiz Augusto von Dentz
  2025-02-25  0:27     ` Pedro Nishiyama
  2025-02-24 21:41   ` Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers bluez.test.bot
  1 sibling, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-24 21:36 UTC (permalink / raw)
  To: Pedro Nishiyama; +Cc: linux-bluetooth, Marcel Holtmann, Johan Hedberg

Hi Pedro,

On Mon, Feb 24, 2025 at 3:54 PM Pedro Nishiyama
<nishiyama.pedro@gmail.com> wrote:
>
> This adds quirks for broken READ_VOICE_SETTING and READ_PAGE_SCAN_TYPE.
>
> Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
> ---
>  include/net/bluetooth/hci.h | 16 ++++++++++++++++
>  net/bluetooth/hci_sync.c    |  6 ++++++
>  2 files changed, 22 insertions(+)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 0d51970d809f..b99818df8ee7 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -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,

Lets split this in 2 parts, one for voice setting and another for page
scan type.

> +       /* 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 */
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index dd770ef5ec36..e76012956020 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -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;

While at it I'd add the checking for the bit as well, that said
perhaps we need to disable SCO link if voice settings cannot be read,
is the controller able to create SCO connections?

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


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers
  2025-02-24 20:54 ` [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles Pedro Nishiyama
  2025-02-24 21:36   ` Luiz Augusto von Dentz
@ 2025-02-24 21:41   ` bluez.test.bot
  1 sibling, 0 replies; 11+ messages in thread
From: bluez.test.bot @ 2025-02-24 21:41 UTC (permalink / raw)
  To: linux-bluetooth, nishiyama.pedro

[-- Attachment #1: Type: text/plain, Size: 1680 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PENDING   0.18 seconds
GitLint                       PENDING   0.16 seconds
SubjectPrefix                 PASS      0.25 seconds
BuildKernel                   PASS      24.16 seconds
CheckAllWarning               PASS      26.55 seconds
CheckSparse                   PASS      31.43 seconds
BuildKernel32                 PASS      24.05 seconds
TestRunnerSetup               PASS      425.71 seconds
TestRunner_l2cap-tester       PASS      20.97 seconds
TestRunner_iso-tester         PASS      31.95 seconds
TestRunner_bnep-tester        PASS      4.78 seconds
TestRunner_mgmt-tester        PASS      120.52 seconds
TestRunner_rfcomm-tester      PASS      8.31 seconds
TestRunner_sco-tester         PASS      9.59 seconds
TestRunner_ioctl-tester       PASS      8.42 seconds
TestRunner_mesh-tester        PASS      6.15 seconds
TestRunner_smp-tester         PASS      7.27 seconds
TestRunner_userchan-tester    PASS      5.02 seconds
IncrementalBuild              PENDING   0.40 seconds

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

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

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles
  2025-02-24 21:36   ` Luiz Augusto von Dentz
@ 2025-02-25  0:27     ` Pedro Nishiyama
  2025-02-25 15:55       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Nishiyama @ 2025-02-25  0:27 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Marcel Holtmann, Johan Hedberg

Hi Luiz,

On Mon, Feb 24, 2025 at 6:36 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Pedro,
>
> On Mon, Feb 24, 2025 at 3:54 PM Pedro Nishiyama
> <nishiyama.pedro@gmail.com> wrote:
> >
> > This adds quirks for broken READ_VOICE_SETTING and READ_PAGE_SCAN_TYPE.
> >
> > Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
> > ---
> >  include/net/bluetooth/hci.h | 16 ++++++++++++++++
> >  net/bluetooth/hci_sync.c    |  6 ++++++
> >  2 files changed, 22 insertions(+)
> >
> > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > index 0d51970d809f..b99818df8ee7 100644
> > --- a/include/net/bluetooth/hci.h
> > +++ b/include/net/bluetooth/hci.h
> > @@ -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,
>
> Lets split this in 2 parts, one for voice setting and another for page
> scan type.
>
> > +       /* 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 */
> > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > index dd770ef5ec36..e76012956020 100644
> > --- a/net/bluetooth/hci_sync.c
> > +++ b/net/bluetooth/hci_sync.c
> > @@ -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;
>
> While at it I'd add the checking for the bit as well, that said
> perhaps we need to disable SCO link if voice settings cannot be read,
> is the controller able to create SCO connections?

I did some tests on the version before the regression and with the patches.
It is possible to create an SCO connection, but the connection is not usable.
Before the regression there is no sound, and with the patches, dmesg
is spammed with "Bluetooth: hci0: corrupted SCO packet".

>
> >         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
> >
>
>
> --
> Luiz Augusto von Dentz


--
Pedro Nishiyama

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles
  2025-02-25  0:27     ` Pedro Nishiyama
@ 2025-02-25 15:55       ` Luiz Augusto von Dentz
  2025-02-26 19:18         ` Pedro Nishiyama
  0 siblings, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-25 15:55 UTC (permalink / raw)
  To: Pedro Nishiyama; +Cc: linux-bluetooth, Marcel Holtmann, Johan Hedberg

Hi Pedro,

On Mon, Feb 24, 2025 at 7:27 PM Pedro Nishiyama
<nishiyama.pedro@gmail.com> wrote:
>
> Hi Luiz,
>
> On Mon, Feb 24, 2025 at 6:36 PM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Pedro,
> >
> > On Mon, Feb 24, 2025 at 3:54 PM Pedro Nishiyama
> > <nishiyama.pedro@gmail.com> wrote:
> > >
> > > This adds quirks for broken READ_VOICE_SETTING and READ_PAGE_SCAN_TYPE.
> > >
> > > Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
> > > ---
> > >  include/net/bluetooth/hci.h | 16 ++++++++++++++++
> > >  net/bluetooth/hci_sync.c    |  6 ++++++
> > >  2 files changed, 22 insertions(+)
> > >
> > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > > index 0d51970d809f..b99818df8ee7 100644
> > > --- a/include/net/bluetooth/hci.h
> > > +++ b/include/net/bluetooth/hci.h
> > > @@ -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,
> >
> > Lets split this in 2 parts, one for voice setting and another for page
> > scan type.
> >
> > > +       /* 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 */
> > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > > index dd770ef5ec36..e76012956020 100644
> > > --- a/net/bluetooth/hci_sync.c
> > > +++ b/net/bluetooth/hci_sync.c
> > > @@ -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;
> >
> > While at it I'd add the checking for the bit as well, that said
> > perhaps we need to disable SCO link if voice settings cannot be read,
> > is the controller able to create SCO connections?
>
> I did some tests on the version before the regression and with the patches.
> It is possible to create an SCO connection, but the connection is not usable.
> Before the regression there is no sound, and with the patches, dmesg
> is spammed with "Bluetooth: hci0: corrupted SCO packet".

Then perhaps we should disable SCO support if it doesn't support read
voice settings.

> >
> > >         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
> > >
> >
> >
> > --
> > Luiz Augusto von Dentz
>
>
> --
> Pedro Nishiyama



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles
  2025-02-25 15:55       ` Luiz Augusto von Dentz
@ 2025-02-26 19:18         ` Pedro Nishiyama
  2025-02-26 19:42           ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Nishiyama @ 2025-02-26 19:18 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Marcel Holtmann, Johan Hedberg

Hello,

On Tue, Feb 25, 2025 at 12:55 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Pedro,
>
> On Mon, Feb 24, 2025 at 7:27 PM Pedro Nishiyama
> <nishiyama.pedro@gmail.com> wrote:
> >
> > Hi Luiz,
> >
> > On Mon, Feb 24, 2025 at 6:36 PM Luiz Augusto von Dentz
> > <luiz.dentz@gmail.com> wrote:
> > >
> > > Hi Pedro,
> > >
> > > On Mon, Feb 24, 2025 at 3:54 PM Pedro Nishiyama
> > > <nishiyama.pedro@gmail.com> wrote:
> > > >
> > > > This adds quirks for broken READ_VOICE_SETTING and READ_PAGE_SCAN_TYPE.
> > > >
> > > > Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
> > > > ---
> > > >  include/net/bluetooth/hci.h | 16 ++++++++++++++++
> > > >  net/bluetooth/hci_sync.c    |  6 ++++++
> > > >  2 files changed, 22 insertions(+)
> > > >
> > > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > > > index 0d51970d809f..b99818df8ee7 100644
> > > > --- a/include/net/bluetooth/hci.h
> > > > +++ b/include/net/bluetooth/hci.h
> > > > @@ -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,
> > >
> > > Lets split this in 2 parts, one for voice setting and another for page
> > > scan type.
> > >
> > > > +       /* 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 */
> > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > > > index dd770ef5ec36..e76012956020 100644
> > > > --- a/net/bluetooth/hci_sync.c
> > > > +++ b/net/bluetooth/hci_sync.c
> > > > @@ -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;
> > >
> > > While at it I'd add the checking for the bit as well, that said
> > > perhaps we need to disable SCO link if voice settings cannot be read,
> > > is the controller able to create SCO connections?
> >
> > I did some tests on the version before the regression and with the patches.
> > It is possible to create an SCO connection, but the connection is not usable.
> > Before the regression there is no sound, and with the patches, dmesg
> > is spammed with "Bluetooth: hci0: corrupted SCO packet".
>
> Then perhaps we should disable SCO support if it doesn't support read
> voice settings.

I'm having some trouble disabling SCO. We can't add BTUSB_BROKEN_ISOC
to the drivers quirks because not all 0a12:0001 are clones with broken
READ_VOICE_SETTING.
The fake identification is done after the btusb_probe, and we set up
the isoc during the btusb_probe.
I'm not sure if removing the isoc device file and releasing its
interface in the hdev->setup is actually safe.

>
> > >
> > > >         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
> > > >
> > >
> > >
> > > --
> > > Luiz Augusto von Dentz
> >
> >
> > --
> > Pedro Nishiyama
>
>
>
> --
> Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles
  2025-02-26 19:18         ` Pedro Nishiyama
@ 2025-02-26 19:42           ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-26 19:42 UTC (permalink / raw)
  To: Pedro Nishiyama; +Cc: linux-bluetooth, Marcel Holtmann, Johan Hedberg

Hi Pedro,

On Wed, Feb 26, 2025 at 2:18 PM Pedro Nishiyama
<nishiyama.pedro@gmail.com> wrote:
>
> Hello,
>
> On Tue, Feb 25, 2025 at 12:55 PM Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
> >
> > Hi Pedro,
> >
> > On Mon, Feb 24, 2025 at 7:27 PM Pedro Nishiyama
> > <nishiyama.pedro@gmail.com> wrote:
> > >
> > > Hi Luiz,
> > >
> > > On Mon, Feb 24, 2025 at 6:36 PM Luiz Augusto von Dentz
> > > <luiz.dentz@gmail.com> wrote:
> > > >
> > > > Hi Pedro,
> > > >
> > > > On Mon, Feb 24, 2025 at 3:54 PM Pedro Nishiyama
> > > > <nishiyama.pedro@gmail.com> wrote:
> > > > >
> > > > > This adds quirks for broken READ_VOICE_SETTING and READ_PAGE_SCAN_TYPE.
> > > > >
> > > > > Signed-off-by: Pedro Nishiyama <nishiyama.pedro@gmail.com>
> > > > > ---
> > > > >  include/net/bluetooth/hci.h | 16 ++++++++++++++++
> > > > >  net/bluetooth/hci_sync.c    |  6 ++++++
> > > > >  2 files changed, 22 insertions(+)
> > > > >
> > > > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > > > > index 0d51970d809f..b99818df8ee7 100644
> > > > > --- a/include/net/bluetooth/hci.h
> > > > > +++ b/include/net/bluetooth/hci.h
> > > > > @@ -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,
> > > >
> > > > Lets split this in 2 parts, one for voice setting and another for page
> > > > scan type.
> > > >
> > > > > +       /* 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 */
> > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > > > > index dd770ef5ec36..e76012956020 100644
> > > > > --- a/net/bluetooth/hci_sync.c
> > > > > +++ b/net/bluetooth/hci_sync.c
> > > > > @@ -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;
> > > >
> > > > While at it I'd add the checking for the bit as well, that said
> > > > perhaps we need to disable SCO link if voice settings cannot be read,
> > > > is the controller able to create SCO connections?
> > >
> > > I did some tests on the version before the regression and with the patches.
> > > It is possible to create an SCO connection, but the connection is not usable.
> > > Before the regression there is no sound, and with the patches, dmesg
> > > is spammed with "Bluetooth: hci0: corrupted SCO packet".
> >
> > Then perhaps we should disable SCO support if it doesn't support read
> > voice settings.
>
> I'm having some trouble disabling SCO. We can't add BTUSB_BROKEN_ISOC
> to the drivers quirks because not all 0a12:0001 are clones with broken
> READ_VOICE_SETTING.
> The fake identification is done after the btusb_probe, and we set up
> the isoc during the btusb_probe.
> I'm not sure if removing the isoc device file and releasing its
> interface in the hdev->setup is actually safe.

Well I was not thinking of disabling the ISOC endpoint if that is what
you meant by adding BTUSB_BROKEN_ISOC, but disabling/fail the creation
of SCO sockets in the above layers if we detect the read voice setting
is not working.

> >
> > > >
> > > > >         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
> > > > >
> > > >
> > > >
> > > > --
> > > > Luiz Augusto von Dentz
> > >
> > >
> > > --
> > > Pedro Nishiyama
> >
> >
> >
> > --
> > Luiz Augusto von Dentz



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers
  2025-03-01  6:22 [PATCH V4 1/4] Bluetooth: Add quirk for broken READ_VOICE_SETTING Pedro Nishiyama
@ 2025-03-01  7:03 ` bluez.test.bot
  0 siblings, 0 replies; 11+ messages in thread
From: bluez.test.bot @ 2025-03-01  7:03 UTC (permalink / raw)
  To: linux-bluetooth, nishiyama.pedro

[-- Attachment #1: Type: text/plain, Size: 2150 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PENDING   0.29 seconds
GitLint                       PENDING   0.20 seconds
SubjectPrefix                 PASS      0.35 seconds
BuildKernel                   PASS      24.21 seconds
CheckAllWarning               PASS      26.45 seconds
CheckSparse                   WARNING   30.12 seconds
BuildKernel32                 PASS      23.86 seconds
TestRunnerSetup               PASS      425.32 seconds
TestRunner_l2cap-tester       PASS      20.66 seconds
TestRunner_iso-tester         PASS      35.46 seconds
TestRunner_bnep-tester        PASS      4.72 seconds
TestRunner_mgmt-tester        FAIL      117.97 seconds
TestRunner_rfcomm-tester      PASS      7.80 seconds
TestRunner_sco-tester         PASS      11.62 seconds
TestRunner_ioctl-tester       PASS      8.22 seconds
TestRunner_mesh-tester        PASS      5.90 seconds
TestRunner_smp-tester         PASS      7.19 seconds
TestRunner_userchan-tester    PASS      4.89 seconds
IncrementalBuild              PENDING   0.72 seconds

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

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

##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
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 - Add Device 3 (AL is full)               Failed       0.195 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-01  7:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24 20:54 [V3 0/2] Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers Pedro Nishiyama
2025-02-24 20:54 ` [V3 1/2] Bluetooth: Add new quirks for fake Bluetooth dongles Pedro Nishiyama
2025-02-24 21:36   ` Luiz Augusto von Dentz
2025-02-25  0:27     ` Pedro Nishiyama
2025-02-25 15:55       ` Luiz Augusto von Dentz
2025-02-26 19:18         ` Pedro Nishiyama
2025-02-26 19:42           ` Luiz Augusto von Dentz
2025-02-24 21:41   ` Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers bluez.test.bot
2025-02-24 20:54 ` [V3 2/2] " Pedro Nishiyama
  -- strict thread matches above, loose matches on Subject: below --
2025-03-01  6:22 [PATCH V4 1/4] Bluetooth: Add quirk for broken READ_VOICE_SETTING Pedro Nishiyama
2025-03-01  7:03 ` Bluetooth: btusb: Fix regression in the initialization of fake Bluetooth controllers bluez.test.bot
2025-02-19 21:53 [PATCH] bluetooth: " Pedro Nishiyama
2025-02-19 22:31 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox