Не работает USB Bluetooth адаптер
Заказал 3 месяца (3, сука, месяца назад, при этом 90% времени посылка пролежала где-то в Казахстане) [url=https://aliexpress.com/item/4000288559314.html][/url] вот такой вот свисток с цветом "Цвет: V5.0 NO drive". Подключил к компу, кеды его не видят. dmesg говорит следующее:
Код:
[ 7920.958192] usb 1-5: new full-speed USB device number 19 using xhci_hcd
[ 7921.267837] usb 1-5: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[ 7921.267838] usb 1-5: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 7921.267839] usb 1-5: Product: BT DONGLE10
[ 7921.280582] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds...

Код:
user@linux ~> sudo hciconfig hci0 up                                
[sudo] пароль для user:
Can't init device hci0: Invalid argument (22)

Код:
user@linux ~> sudo btmon
Bluetooth monitor ver 5.53
= Note: Linux version 5.7.16-xanmod2 (x86_64)                                                                                                                            0.152863
= Note: Bluetooth subsystem version 2.22                                                                                                                                 0.152866
= New Index: 00:1A:7D:DA:71:12 (Primary,USB,hci0)                                                                                                                 [hci0] 0.152867
@ MGMT Open: bluetoothd (privileged) version 1.16                                                                                                               {0x0001} 0.152868
@ MGMT Open: btmon (privileged) version 1.16                                                                                                                    {0x0002} 0.152885
@ RAW Open: hciconfig (privileged) version 2.22                                                                                                                {0x0003} 12.936138
= Open Index: 00:1A:7D:DA:71:12                                                                                                                                  [hci0] 13.042029
= Index Info: 00:1A:7D:DA:71:12 (Cambridge Silicon Radio)                                                                                                        [hci0] 13.042034
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0                                                                                            #1 [hci0] 13.042042
> HCI Event: Command Complete (0x0e) plen 12                                                                                                                  #2 [hci0] 13.046009
      Read Local Version Information (0x04|0x0001) ncmd 1
        Status: Success (0x00)
        HCI version: Bluetooth 4.0 (0x06) - Revision 12576 (0x3120)
        LMP version: Bluetooth 4.0 (0x06) - Subversion 8891 (0x22bb)
        Manufacturer: Cambridge Silicon Radio (10)
< HCI Command: Reset (0x03|0x0003) plen 0                                                                                                                     #3 [hci0] 13.046058
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                   #4 [hci0] 13.059012
      Reset (0x03|0x0003) ncmd 1
        Status: Success (0x00)
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0                                                                                             #5 [hci0] 13.059052
> HCI Event: Command Complete (0x0e) plen 12                                                                                                                  #6 [hci0] 13.062008
      Read Local Supported Features (0x04|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0xbf 0x2e 0x4d 0xfa 0xd8 0x3d 0x7b 0x87
          3 slot packets
          5 slot packets
          Encryption
          Slot offset
          Timing accuracy
          Role switch
          Sniff mode
          Power control requests
          Channel quality driven data rate (CQDDR)
          SCO link
          HV3 packets
          CVSD synchronous data
          Power control
          Transparent synchronous data
          Flow control lag (most significant bit)
          Enhanced Data Rate ACL 2 Mbps mode
          Enhanced inquiry scan
          Interlaced inquiry scan
          Interlaced page scan
          RSSI with inquiry results
          Extended SCO link (EV3 packets)
          AFH capable slave
          AFH classification slave
          LE Supported (Controller)
          3-slot Enhanced Data Rate ACL packets
          5-slot Enhanced Data Rate ACL packets
          Pause encryption
          AFH capable master
          AFH classification master
          Enhanced Data Rate eSCO 2 Mbps mode
          Extended Inquiry Response
          Simultaneous LE and BR/EDR (Controller)
          Secure Simple Pairing
          Encapsulated PDU
          Erroneous Data Reporting
          Non-flushable Packet Boundary Flag
          Link Supervision Timeout Changed Event
          Inquiry TX Power Level
          Enhanced Power Control
          Extended features
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0                                                                                            #7 [hci0] 13.062022
> HCI Event: Command Complete (0x0e) plen 12                                                                                                                  #8 [hci0] 13.066009
      Read Local Version Information (0x04|0x0001) ncmd 1
        Status: Success (0x00)
        HCI version: Bluetooth 4.0 (0x06) - Revision 12576 (0x3120)
        LMP version: Bluetooth 4.0 (0x06) - Subversion 8891 (0x22bb)
        Manufacturer: Cambridge Silicon Radio (10)
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0                                                                                                              #9 [hci0] 13.066019
> HCI Event: Command Complete (0x0e) plen 10                                                                                                                 #10 [hci0] 13.070007
      Read BD ADDR (0x04|0x0009) ncmd 1
        Status: Success (0x00)
        Address: 00:1A:7D:DA:71:12 (cyber-blue(HK)Ltd)
< HCI Command: Read Buffer Size (0x04|0x0005) plen 0                                                                                                         #11 [hci0] 13.070056
> HCI Event: Command Complete (0x0e) plen 11                                                                                                                 #12 [hci0] 13.074010
      Read Buffer Size (0x04|0x0005) ncmd 1
        Status: Success (0x00)
        ACL MTU: 679  ACL max packet: 8
        SCO MTU: 48   SCO max packet: 16
< HCI Command: Read Class of Device (0x03|0x0023) plen 0                                                                                                     #13 [hci0] 13.074022
> HCI Event: Command Complete (0x0e) plen 7                                                                                                                  #14 [hci0] 13.078006
      Read Class of Device (0x03|0x0023) ncmd 1
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
< HCI Command: Read Local Name (0x03|0x0014) plen 0                                                                                                          #15 [hci0] 13.078031
> HCI Event: Command Complete (0x0e) plen 252                                                                                                                #16 [hci0] 13.097012
      Read Local Name (0x03|0x0014) ncmd 1
        Status: Success (0x00)
        Name: CSR8510 A10

< HCI Command: Read Voice Setting (0x03|0x0025) plen 0                                                                                                       #17 [hci0] 13.097028
> HCI Event: Command Complete (0x0e) plen 6                                                                                                                  #18 [hci0] 13.100011
      Read Voice Setting (0x03|0x0025) ncmd 1
        Status: Success (0x00)
        Setting: 0x0000
          Input Coding: Linear
          Input Data Format: 1's complement
          Input Sample Size: 8-bit
          # of bits padding at MSB: 0
          Air Coding Format: CVSD
< HCI Command: Read Number of Supported IAC (0x03|0x0038) plen 0                                                                                             #19 [hci0] 13.100023
> HCI Event: Command Complete (0x0e) plen 5                                                                                                                  #20 [hci0] 13.104010
      Read Number of Supported IAC (0x03|0x0038) ncmd 1
        Status: Success (0x00)
        Number of IAC: 2
< HCI Command: Read Current IAC LAP (0x03|0x0039) plen 0                                                                                                     #21 [hci0] 13.104036
> HCI Event: Command Complete (0x0e) plen 8                                                                                                                  #22 [hci0] 13.108011
      Read Current IAC LAP (0x03|0x0039) ncmd 1
        Status: Success (0x00)
        Number of IAC: 1
        Access code: 0x9e8b33 (General Inquiry)
< HCI Command: Set Event Filter (0x03|0x0005) plen 1                                                                                                         #23 [hci0] 13.108035
        Type: Clear All Filters (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                  #24 [hci0] 13.112011
      Set Event Filter (0x03|0x0005) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)
= Close Index: 00:1A:7D:DA:71:12                                                                                                                                 [hci0] 13.112047
@ RAW Close: hciconfig

Гуглёж говорит, что надо удалить несколько строк из модуля ядра. На данный момент качаю исходники ядра, но вдруг есть более или менее нормальное решение?

Код:
user@linux ~> uname -a
Linux linux 5.7.16-xanmod2 #0~git20200820.b01d003 SMP PREEMPT Thu Aug 20 00:35:53 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
It's time to kick gum and chew ass. And i'm all out of ass.
Ответ
С более старым (5.4) ядром dmesg говорит это:

Код:
[   57.593204] usb 1-4: new full-speed USB device number 4 using xhci_hcd
[   57.907866] usb 1-4: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[   57.907868] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[   57.907869] usb 1-4: Product: BT DONGLE10
[   57.954317] Bluetooth: Core ver 2.22
[   57.954337] NET: Registered protocol family 31
[   57.954337] Bluetooth: HCI device and connection manager initialized
[   57.954340] Bluetooth: HCI socket layer initialized
[   57.954341] Bluetooth: L2CAP socket layer initialized
[   57.954343] Bluetooth: SCO socket layer initialized
[   57.973569] usbcore: registered new interface driver btusb
[   58.004992] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   58.004993] Bluetooth: BNEP filters: protocol multicast
[   58.004995] Bluetooth: BNEP socket layer initialized

Всё ещё не работает

При попытке сделать hciconfig up, в dmesg появляется следующее:
Код:
[   76.689897] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds...
[   76.714509] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   76.714510] Bluetooth: BNEP filters: protocol multicast
[   76.714514] Bluetooth: BNEP socket layer initialized
[   80.278063] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds...
[   80.302143] debugfs: File 'dut_mode' in directory 'hci0' already present!

Код:
user@linux ~> hciconfig -a
hci0:   Type: Primary  Bus: USB
        BD Address: 00:1A:7D:DA:71:12  ACL MTU: 679:8  SCO MTU: 48:16
        DOWN
        RX bytes:706 acl:0 sco:0 events:22 errors:0
        TX bytes:68 acl:0 sco:0 commands:22 errors:0
        Features: 0xbf 0x2e 0x4d 0xfa 0xd8 0x3d 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3
        Link policy:
        Link mode: SLAVE ACCEPT
It's time to kick gum and chew ass. And i'm all out of ass.
Ответ
UPD: ядро сменил на другое:
Код:
user@linux ~> uname -a
Linux linux 5.7.0-18.1-liquorix-amd64 #1 ZEN SMP PREEMPT liquorix 5.7-23ubuntu1~focal (2020-08-26) x86_64 x86_64 x86_64 GNU/Linux

Для новых версий ядра патч пока не нашёл. Скрипт отсюда пытается качать исходники от 5.7.0, а их на сервере нет, и вообще пытается что-то копировать из несуществующего места:
Код:
cp /usr/lib/modules/$fullversion/build/.config $name/
cp /usr/lib/modules/$fullversion/build/Module.symvers $name/

Но если подменить версию скачиваемых исходников на 5.7.1, и пути к модулям, то выйдет это:
Код:
==> Applying CSR dongle fix
patching file drivers/bluetooth/btusb.c
Hunk #1 succeeded at 1630 (offset -90 lines).
Hunk #2 succeeded at 1650 (offset -90 lines).
Hunk #3 succeeded at 3942 (offset -111 lines).
patching file include/net/bluetooth/bluetooth.h
patching file include/net/bluetooth/hci.h
Hunk #1 FAILED at 227.
1 out of 1 hunk FAILED -- saving rejects to file include/net/bluetooth/hci.h.rej
patching file net/bluetooth/hci_core.c
Hunk #1 succeeded at 605 (offset -1 lines).
Hunk #2 succeeded at 847 (offset -5 lines).
It's time to kick gum and chew ass. And i'm all out of ass.
Ответ