Thread (17 messages) flat view 17 messages, 8 authors, 2021-08-10

Re: [PATCH] Bluetooth: btusb: check SCO MTU before enabling USB ALT 3 for WBS

From: Joseph Hwang <hidden>
Date: 2021-07-17 13:35:12

It looks reasonable to check sco_mtu. My suggestion is to use
hci_packet_size_usb_alt[3] instead of the magic number 72.

Thanks,
Joseph


On Sat, Jul 17, 2021 at 1:58 AM Pauli Virtanen [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Some USB BT adapters don't satisfy the MTU requirement mentioned in
commit e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS")
and have ALT 3 setting that produces no/garbled audio. Check that the MTU
condition is satisfied, and fall back to ALT 1 if not.

Tested with USB adapters (mtu<72, produce sound only with ALT1)
BCM20702A1 0b05:17cb, CSR8510A10 0a12:0001, and (mtu>=72, ALT3)
RTL8761BU 0bda:8771, Intel AX200 8087:0029 (after disabling ALT6).

Signed-off-by: Pauli Virtanen <redacted>
---
 drivers/bluetooth/btusb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index a9855a2dd561..3ee66e415c4d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1763,9 +1763,11 @@ static void btusb_work(struct work_struct *work)
                        /* Because mSBC frames do not need to be aligned to the
                         * SCO packet boundary. If support the Alt 3, use the
                         * Alt 3 for HCI payload >= 60 Bytes let air packet
-                        * data satisfy 60 bytes.
+                        * data satisfy 60 bytes. USB Alt 3 support also needs
+                        * HFP transparent MTU >= 72 Bytes.
                         */
-                       if (new_alts == 1 && btusb_find_altsetting(data, 3))
+                       if (new_alts == 1 && hdev->sco_mtu >= 72 &&
+                           btusb_find_altsetting(data, 3))
                                new_alts = 3;
                }

--
2.31.1

-- 

Joseph Shyh-In Hwang
Email: josephsih@google.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help