Bluetooth: btusb: Fix regression with CSR controllers
Luiz Augusto von Dentz
maintainerPATCH v2 1/1 Bluetooth: btusb: Fix regression with CSR controllers
From: Luiz Augusto von Dentz <[email protected]>
CSR controllers don't seem to handle short-transfer properly which cause command to timeout.
--- drivers/bluetooth/btusb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/bluetooth/btusb.c +9 -4
@@ -1366,10 +1366,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)if (!urb)return -ENOMEM ; -/* Use maximum HCI Event size so the USB stack handles -* ZPL/short-transfer automatically. -*/ - size =HCI_MAX_EVENT_SIZE ; +if (le16_to_cpu (data->udev->descriptor.idVendor) ==0x0a12 && +le16_to_cpu (data->udev->descriptor.idProduct) ==0x0001 ) +/* Fake CSR devices don't seem to support sort-transter */ + size =le16_to_cpu (data->intr_ep->wMaxPacketSize); +else +/* Use maximum HCI Event size so the USB stack handles +* ZPL/short-transfer automatically. +*/ + size =HCI_MAX_EVENT_SIZE ; buf =kmalloc (size, mem_flags);if (!buf) {
Signature · 1 line
2.47.0
Dear Luiz,
Thank you for the patch, and fixing the regression. Could short-transfers be mentioned in the summary/title to make it more specific?
Am 15.10.24 um 17:37 schrieb Luiz Augusto von Dentz:
Quoted 4 lines
From: Luiz Augusto von Dentz <[email protected]>
CSR controllers don't seem to handle short-transfer properly which cause command to timeout.
The verb is spelled with a space: time out.
Could you elaborate more? Why is starting a quirk list the right thing to do? It’s unlikely more controllers are affected? For people using git log --grep the product name would be nice to have in the commit message:
Product: BT DONGLE10
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Quoted 12 lines
Fixes 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")Signed-off-by Luiz Augusto von Dentz <[email protected]>--- drivers/bluetooth/btusb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/bluetooth/btusb.c +0
-0
drivers/bluetooth/btusb.c static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · line 1371
Quoted 10 lines
drivers/bluetooth/btusb.c +3
-4@@ -1366,10 +1366,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)if (!urb)return -ENOMEM ; -/* Use maximum HCI Event size so the USB stack handles -* ZPL/short-transfer automatically. -*/ - size =HCI_MAX_EVENT_SIZE ; +if (le16_to_cpu (data->udev->descriptor.idVendor) ==0x0a12 && +le16_to_cpu (data->udev->descriptor.idProduct) ==0x0001 ) +/* Fake CSR devices don't seem to support sort-transter */
s*h*ort
drivers/bluetooth/btusb.c static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · line 1372
Quoted 1 line
drivers/bluetooth/btusb.c +1
-0+ size =le16_to_cpu (data->intr_ep->wMaxPacketSize);
A warning would be nice to have so motivated users could bug Cambridge Silicon Radio to fix/improve their devices.
drivers/bluetooth/btusb.c static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · line 1380
Quoted 8 lines
drivers/bluetooth/btusb.c +5
-0+else +/* Use maximum HCI Event size so the USB stack handles +* ZPL/short-transfer automatically. +*/ + size =HCI_MAX_EVENT_SIZE ; buf =kmalloc (size, mem_flags);if (!buf) {
Is Intel going to get such a device to add to a test lab?
Kind regards,
Paul
Luiz Augusto von Dentz
maintainerHi Paul,
Quoted 6 lines · Paul Menzel
Dear Luiz,
Thank you for the patch, and fixing the regression. Could short-transfers be mentioned in the summary/title to make it more specific?
Sure.
Quoted 11 lines
Am 15.10.24 um 17:37 schrieb Luiz Augusto von Dentz:
Quoted 4 lines
From: Luiz Augusto von Dentz <[email protected]>
CSR controllers don't seem to handle short-transfer properly which cause command to timeout.
The verb is spelled with a space: time out.
Could you elaborate more? Why is starting a quirk list the right thing to do? It’s unlikely more controllers are affected?
Elaborate on what? USB short-transfer is a mandatory feature of USB, I can quote the USB spec if that makes it clearer, now if there are more controllers affected only time will tell since I don't think anyone has a lab to validate these changes on all supported models by btusb driver.
Quoted 7 lines
For people using
git log --grepthe product name would be nice to have in the commit message:Product: BT DONGLE10
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Ack
Quoted 25 lines
Quoted 12 lines
Fixes 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")Signed-off-by Luiz Augusto von Dentz <[email protected]>--- drivers/bluetooth/btusb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/bluetooth/btusb.c +0
-0drivers/bluetooth/btusb.c static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · line 1371
Quoted 10 lines
drivers/bluetooth/btusb.c +3
-4@@ -1366,10 +1366,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)if (!urb)return -ENOMEM ; -/* Use maximum HCI Event size so the USB stack handles -* ZPL/short-transfer automatically. -*/ - size =HCI_MAX_EVENT_SIZE ; +if (le16_to_cpu (data->udev->descriptor.idVendor) ==0x0a12 && +le16_to_cpu (data->udev->descriptor.idProduct) ==0x0001 ) +/* Fake CSR devices don't seem to support sort-transter */ s*h*ort
Quoted 4 lines
drivers/bluetooth/btusb.c static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · line 1372
Quoted 1 line
drivers/bluetooth/btusb.c +1
-0+ size =le16_to_cpu (data->intr_ep->wMaxPacketSize);A warning would be nice to have so motivated users could bug Cambridge Silicon Radio to fix/improve their devices.
These are fake CSR dongles, there are many things wrong with them and it is already warned when detected.
Quoted 10 lines
drivers/bluetooth/btusb.c static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) · line 1380
Quoted 8 lines
drivers/bluetooth/btusb.c +5
-0+else +/* Use maximum HCI Event size so the USB stack handles +* ZPL/short-transfer automatically. +*/ + size =HCI_MAX_EVENT_SIZE ; buf =kmalloc (size, mem_flags);if (!buf) {Is Intel going to get such a device to add to a test lab?
Don't think we can get a hold of one of these dongles, they are not really from CSR and they are really old as well, so I guess the only option would be for someone to donate it or something.
Quoted 4 lines
Kind regards,
Paul
Signature · 1 line
Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 10 lines · On Tue, 15 Oct 2024 11:37:19 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
CSR controllers don't seem to handle short-transfer properly which cause command to timeout.
Fixes 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")Signed-off-by Luiz Augusto von Dentz <[email protected]>[...]
Here is the summary with links:
- [v2] Bluetooth: btusb: Fix regression with CSR controllers
https://git.kernel.org/bluetooth/bluetooth-next/c/b29d4ac72975
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html