Bluetooth: btusb: Always fallback to alt 1 for WBS
Subsystems (2)
PATCH 1/1 Bluetooth: btusb: Always fallback to alt 1 for WBS
When alt mode 6 is not available, fallback to the kernel <= 5.7 behavior of always using alt mode 1.
Prior to kernel 5.8, btusb would always use alt mode 1 for WBS (Wide Band Speech aka mSBC aka transparent SCO). In commit baac6276c0a9 ("Bluetooth: btusb: handle mSBC audio over USB Endpoints") this was changed to use alt mode 6, which is the recommended mode in the Bluetooth spec (Specifications of the Bluetooth System, v5.0, Vol 4.B §2.2.1). However, many if not most BT USB adapters do not support alt mode 6. In fact, I have been unable to find any which do.
In kernel 5.8, this was changed to use alt mode 6, and if not available, use alt mode 0. But mode 0 has a zero byte max packet length and can not possibly work. It is just there as a zero-bandwidth dummy mode to work around a USB flaw that would prevent device enumeration if insufficient bandwidth were available for the lowest isoc mode supported.
In effect, WBS was broken for all USB-BT adapters that do not support alt 6, which appears to nearly all of them.
Then in commit 461f95f04f19 ("Bluetooth: btusb: USB alternate setting 1 for WBS") the 5.7 behavior was restored, but only for Realtek adapters.
I've tested a Broadcom BRCM20702A and CSR 8510 adapter, both work with the 5.7 behavior and do not with the 5.8.
So get rid of the Realtek specific flag and use the 5.7 behavior for all adapters as a fallback when alt 6 is not available. This was the kernel's behavior prior to 5.8 and I can find no adapters for which it is not correct. And even if there is an adapter for which this does not work, the current behavior would be to fall back to alt 0, which can not possibly work either, and so is no better.
--- drivers/bluetooth/btusb.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/bluetooth/btusb.c +6 -14
@@ -506,7 +506,6 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {#define BTUSB_HW_RESET_ACTIVE 12#define BTUSB_TX_WAIT_VND_EVT 13#define BTUSB_WAKEUP_DISABLE 14 -#define BTUSB_USE_ALT1_FOR_WBS 15struct btusb_data {struct hci_dev *hdev;
@@ -1736,15 +1735,12 @@ static void btusb_work(struct work_struct *work) new_alts = data->sco_num; } }else if (data->air_mode ==HCI_NOTIFY_ENABLE_SCO_TRANSP ) { -/* Check if Alt 6 is supported for Transparent audio */ -if (btusb_find_altsetting (data,6 )) { - data->usb_alt6_packet_flow = true; - new_alts =6 ; - }else if (test_bit (BTUSB_USE_ALT1_FOR_WBS , &data->flags)) { - new_alts =1 ; - }else { -bt_dev_err (hdev,"Device does not support ALT setting 6" ); - } +/* Bluetooth USB spec recommends alt 6 (63 bytes), but +* many adapters do not support it. Alt 1 appears to +* work for all adapters that do not have alt 6, and +* which work with WBS at all. +*/ + new_alts =btusb_find_altsetting (data,6 ) ?6 :1 ; }if (btusb_switch_alt_setting (hdev, new_alts) <0 )
@@ -4548,10 +4544,6 @@ static int btusb_probe(struct usb_interface *intf,* (DEVICE_REMOTE_WAKEUP) */ set_bit (BTUSB_WAKEUP_DISABLE , &data->flags); -if (btusb_find_altsetting (data,1 )) -set_bit (BTUSB_USE_ALT1_FOR_WBS , &data->flags); -else -bt_dev_err (hdev,"Device does not support ALT setting 1" ); }if (!reset)
Signature · 1 line
2.26.2
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=399381
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - PASS
##############################
Test: CheckBuildK - PASS
---
Regards,
Linux Bluetooth
Marcel Holtmann
maintainerHi Trent,
Quoted 34 lines
When alt mode 6 is not available, fallback to the kernel <= 5.7 behavior of always using alt mode 1.
Prior to kernel 5.8, btusb would always use alt mode 1 for WBS (Wide Band Speech aka mSBC aka transparent SCO). In commit
baac6276c0a9("Bluetooth: btusb: handle mSBC audio over USB Endpoints") this was changed to use alt mode 6, which is the recommended mode in the Bluetooth spec (Specifications of the Bluetooth System, v5.0, Vol 4.B §2.2.1). However, many if not most BT USB adapters do not support alt mode 6. In fact, I have been unable to find any which do.In kernel 5.8, this was changed to use alt mode 6, and if not available, use alt mode 0. But mode 0 has a zero byte max packet length and can not possibly work. It is just there as a zero-bandwidth dummy mode to work around a USB flaw that would prevent device enumeration if insufficient bandwidth were available for the lowest isoc mode supported.
In effect, WBS was broken for all USB-BT adapters that do not support alt 6, which appears to nearly all of them.
Then in commit
461f95f04f19("Bluetooth: btusb: USB alternate setting 1 for WBS") the 5.7 behavior was restored, but only for Realtek adapters.I've tested a Broadcom BRCM20702A and CSR 8510 adapter, both work with the 5.7 behavior and do not with the 5.8.
So get rid of the Realtek specific flag and use the 5.7 behavior for all adapters as a fallback when alt 6 is not available. This was the kernel's behavior prior to 5.8 and I can find no adapters for which it is not correct. And even if there is an adapter for which this does not work, the current behavior would be to fall back to alt 0, which can not possibly work either, and so is no better.
Quoted 4 lines
Signed-off-by Trent Piepho <[email protected]>---
drivers/bluetooth/btusb.c| 20 ++++++--------------1 file changed, 6 insertions(+), 14 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Sjoerd Simons
Tested-byQuoted 13 lines · Marcel Holtmann
Hi Trent,
Quoted 10 lines
When alt mode 6 is not available, fallback to the kernel <= 5.7 behavior of always using alt mode 1.
Prior to kernel 5.8, btusb would always use alt mode 1 for WBS (Wide Band Speech aka mSBC aka transparent SCO). In commit
baac6276c0a9("Bluetooth: btusb: handle mSBC audio over USB Endpoints") this was changed to use alt mode 6, which is the recommended mode in the Bluetooth spec (Specifications of the Bluetooth System, v5.0, Vol 4.B §2.2.1). However, many if not most BT USB adapters do not support alt mode 6. In fact, I have been unable to find any which do.
Quoted 1 line
patch has been applied to bluetooth-next tree.
For easier application to the stable tree(s) this should probably get:
In my testing this indeed fixes mSBC audio with both a Belkin (Broadcom BCM20702A, 050d:065a) and an Intel Bluetooth (8087:0a2b) adapters.
Regards,
Sjoerd
Sebastian Reichel
Tested-by[+cc [email protected]]
Hi,
Quoted 16 lines · Sjoerd Simons
Quoted 13 lines · Marcel Holtmann
Hi Trent,
Quoted 10 lines
When alt mode 6 is not available, fallback to the kernel <= 5.7 behavior of always using alt mode 1.
Prior to kernel 5.8, btusb would always use alt mode 1 for WBS (Wide Band Speech aka mSBC aka transparent SCO). In commit
baac6276c0a9("Bluetooth: btusb: handle mSBC audio over USB Endpoints") this was changed to use alt mode 6, which is the recommended mode in the Bluetooth spec (Specifications of the Bluetooth System, v5.0, Vol 4.B §2.2.1). However, many if not most BT USB adapters do not support alt mode 6. In fact, I have been unable to find any which do.Quoted 1 line
patch has been applied to bluetooth-next tree.
Quoted 7 lines
For easier application to the stable tree(s) this should probably get:
Fixes baac6276c0a9 ("Bluetooth: btusb: handle mSBC audio over USB Endpoints")In my testing this indeed fixes mSBC audio with both a Belkin (Broadcom BCM20702A, 050d:065a) and an Intel Bluetooth (8087:0a2b) adapters.
Tested-by Sjoerd Simons <[email protected]>
Tested on Intel AX200 Bluetooth (8087:0029):
The patch has been merged to Linus' tree today and I think it should be applied to the 5.10 tree, which is used by Debian. This patch is required to use BT headset with bidirectional-audio in acceptable quality (That also requires proper userspace software, e.g. pipewire 0.3.22, which Sjoerd uploaded to Debian experimental).
Patch applies cleanly on 5.10.
Thanks,
-- Sebastian