Bluetooth: btusb: Check for unexpected bytes when defragmenting HCI frames
Hi Arkadiusz,
I tested the patch with 33fa:0010. It initialized successfully and is working well so far.
It initially froze while scanning for more than 30 seconds, but after a little bit of USB Hokey-Pokey, it works better now. However, when using headphones, there is some choppiness in the audio during scanning, as if it might freeze again.
I will leave some logs in case they are helpful.
----
# cat /sys/kernel/debug/usb/devices ... T: Bus=01 Lev=01 Prnt=01 Port=07 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=33fa ProdID=0010 Rev=88.91 S: Product=UGREEN BT5.4 Adapter C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms ... ----
----
# dmesg ... [ 56.023305] usb 1-8: new full-speed USB device number 4 using xhci_hcd [ 56.398644] usb 1-8: New USB device found, idVendor=33fa, idProduct=0010, bcdDevice=88.91 [ 56.398653] usb 1-8: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [ 56.398657] usb 1-8: Product: UGREEN BT5.4 Adapter [ 56.474345] Bluetooth: Core ver 2.22 [ 56.474375] NET: Registered PF_BLUETOOTH protocol family [ 56.474377] Bluetooth: HCI device and connection manager initialized [ 56.474382] Bluetooth: HCI socket layer initialized [ 56.474386] Bluetooth: L2CAP socket layer initialized [ 56.474391] Bluetooth: SCO socket layer initialized [ 56.503855] usbcore: registered new interface driver btusb [ 56.566661] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 56.566667] Bluetooth: BNEP filters: protocol multicast [ 56.566671] Bluetooth: BNEP socket layer initialized [ 56.639531] Bluetooth: hci0: Unexpected continuation: 1 bytes [ 56.784552] Bluetooth: hci0: Unexpected continuation: 1 bytes [ 56.858686] Bluetooth: MGMT ver 1.23 ... ----
Dongle scan fault journal segment
----
...
sep 22 08:03:31 AHost systemd[1156]: Reached target Bluetooth.
sep 22 08:03:31 AHost systemd[1]: Started Load/Save RF Kill Switch Status.
sep 22 08:03:32 AHost kernel: Bluetooth: hci0: Unexpected continuation: 1 bytes
sep 22 08:03:32 AHost kernel: Bluetooth: hci0: Unexpected continuation: 1 bytes
sep 22 08:03:32 AHost bluetoothd[549]: Battery Provider Manager created
sep 22 08:03:32 AHost kernel: Bluetooth: MGMT ver 1.23
sep 22 08:03:32 AHost bluetoothd[549]: Endpoint registered: sender=:1.83 path=/MediaEndpoint/A2DPSource/ldac
...
sep 22 08:03:32 AHost bluetoothd[549]: Endpoint registered: sender=:1.83 path=/MediaEndpoint/A2DPSource/opus_05_duplex sep 22 08:03:36 AHost systemd[1]: systemd-rfkill.service: Deactivated successfully.
sep 22 08:04:44 AHost kernel: Bluetooth: hci0: Opcode 0x2042 failed: -110
sep 22 08:04:44 AHost kernel: Bluetooth: hci0: command 0x2042 tx timeout
sep 22 08:04:44 AHost kernel: Bluetooth: hci0: Unable to disable scanning: -110
sep 22 08:04:44 AHost kernel: Bluetooth: hci0: Opcode 0x0401 failed: -12
sep 22 08:04:48 AHost kernel: Bluetooth: hci0: Controller not accepting commands anymore: ncmd = 0 sep 22 08:04:48 AHost kernel: Bluetooth: hci0: Injecting HCI hardware error event
sep 22 08:04:48 AHost kernel: Bluetooth: hci0: hardware error 0x00
sep 22 08:04:48 AHost kernel: Bluetooth: hci0: Opcode 0x0c03 failed: -12
sep 22 08:04:52 AHost kernel: Bluetooth: hci0: Controller not accepting commands anymore: ncmd = 0 sep 22 08:04:52 AHost kernel: Bluetooth: hci0: Injecting HCI hardware error event
sep 22 08:06:17 AHost kernel: Bluetooth: hci0: Opcode 0x0c03 failed: -12
sep 22 08:06:17 AHost bluetoothd[549]: Failed to set mode: No Resources (0x07)
sep 22 08:06:21 AHost kernel: Bluetooth: hci0: Controller not accepting commands anymore: ncmd = 0 sep 22 08:06:21 AHost kernel: Bluetooth: hci0: Injecting HCI hardware error event
sep 22 08:06:27 AHost kernel: Bluetooth: hci0: Opcode 0x0c03 failed: -12
sep 22 08:06:27 AHost bluetoothd[549]: Failed to set mode: No Resources (0x07)
sep 22 08:06:31 AHost kernel: Bluetooth: hci0: Controller not accepting commands anymore: ncmd = 0 sep 22 08:06:31 AHost kernel: Bluetooth: hci0: Injecting HCI hardware error event
...
----
Quoted 4 lines
It initially froze while scanning for more than 30 seconds, but after a little bit of USB Hokey-Pokey, it works better now. However, when using headphones, there is some choppiness in the audio during scanning, as if it might freeze again.
This patch is only for the dongle initialization failure. There might be some other issues with this chip. I guess that when this patch will land in the mainline (if it will) we might see more bug reports from people trying to actually use it. It's rather impossible that this chip does not have any other quirk :) However, I do not work for Ugreen or Barrot so please do not expect that I will fix any of such issues. Anyway I might submit patches fixing things related to my use cases (if free time will allow).