Skip to content

Commit 2c1dda2

Browse files
committed
Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001
Fake CSR controllers don't seem to handle short-transfer properly which cause command to time out: kernel: usb 1-1: new full-speed USB device number 19 using xhci_hcd kernel: usb 1-1: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91 kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0 kernel: usb 1-1: Product: BT DONGLE10 ... Bluetooth: hci1: Opcode 0x1004 failed: -110 kernel: Bluetooth: hci1: command 0x1004 tx timeout According to USB Spec 2.0 Section 5.7.3 Interrupt Transfer Packet Size Constraints a interrupt transfer is considered complete when the size is 0 (ZPL) or < wMaxPacketSize: 'When an interrupt transfer involves more data than can fit in one data payload of the currently established maximum size, all data payloads are required to be maximum-sized except for the last data payload, which will contain the remaining data. An interrupt transfer is complete when the endpoint does one of the following: • Has transferred exactly the amount of data expected • Transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet' Link: https://bugzilla.kernel.org/show_bug.cgi?id=219365 Fixes: 7b05933 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 64a9099 commit 2c1dda2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/bluetooth/btusb.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,10 +1345,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
13451345
if (!urb)
13461346
return -ENOMEM;
13471347

1348-
/* Use maximum HCI Event size so the USB stack handles
1349-
* ZPL/short-transfer automatically.
1350-
*/
1351-
size = HCI_MAX_EVENT_SIZE;
1348+
if (le16_to_cpu(data->udev->descriptor.idVendor) == 0x0a12 &&
1349+
le16_to_cpu(data->udev->descriptor.idProduct) == 0x0001)
1350+
/* Fake CSR devices don't seem to support sort-transter */
1351+
size = le16_to_cpu(data->intr_ep->wMaxPacketSize);
1352+
else
1353+
/* Use maximum HCI Event size so the USB stack handles
1354+
* ZPL/short-transfer automatically.
1355+
*/
1356+
size = HCI_MAX_EVENT_SIZE;
13521357

13531358
buf = kmalloc(size, mem_flags);
13541359
if (!buf) {

0 commit comments

Comments
 (0)