Bluetooth adapter configuration issue (ID 0a12:0001)

25,494

Solution 1

There are several versions of this device with the same USB ID. According to some are these fake, but I suspect these are only newer models of the chip.

There are a couple of quirks needed to get the chip to work and one needs to patch the kernel code responsible for enabling these quirks to test for these newer models:

--- drivers/bluetooth/btusb.c.old   2020-03-31 19:14:11.765239911 +0100
+++ drivers/bluetooth/btusb.c   2020-03-31 19:22:17.035003199 +0100
@@ -1643,4 +1643,6 @@
    /* Detect controllers which aren't real CSR ones. */
    if (le16_to_cpu(rp->manufacturer) != 10 ||
+       le16_to_cpu(rp->lmp_subver) == 0x0811 ||
+       le16_to_cpu(rp->lmp_subver) == 0x0812 ||
        le16_to_cpu(rp->lmp_subver) == 0x0c5c) {
        /* Clear the reset quirk since this is not an actual
@@ -3873,5 +3875,5 @@

        /* Fake CSR devices with broken commands */
-       if (bcdDevice <= 0x100 || bcdDevice == 0x134)
+       if (bcdDevice <= 0x100 || bcdDevice == 0x134 || bcdDevice == 0x8891)
            hdev->setup = btusb_setup_csr;

I don't give a guarantee that this fixes the issue for all newer models and it may need additional tests to include more LMP sub versions and bcdDevice numbers. However, the above does work for some users who have been using the newer Bluetooth 4.0 models and for myself, using a Bluetooth 5.0 model.

It brings up the device as shown here:

# hciconfig
hci0:   Type: Primary  Bus: USB
    BD Address: 00:1A:7D:DA:71:11  ACL MTU: 679:9  SCO MTU: 48:16
    UP RUNNING 
    RX bytes:56724 acl:29 sco:0 events:7890 errors:0
    TX bytes:4782028 acl:7788 sco:0 commands:84 errors:0

This was tested with kernel 5.5.13 and a cheap Bluetooth 5.0 dongle from AliExpress, and it now lets me connected to a Bluetooth 5.0 headset.

The dongle works just fine under Windows 10 by the way.

Addition: Turning Off USB Auto-Suspend

The auto-suspension of USB ports can interfere with Bluetooth USB dongles. While auto-suspend helps to save power and the devices should wake up quickly on their own can this fail and so degrade the Bluetooth connectivity. By default does the kernel suspend USB ports after 2 seconds. This can be disabled either for all USB ports or only for individual ones, and the Bluetooth USB driver has got a parameter, which specifically controls this for USB-attached Bluetooth dongles. For example, to see the current status:

# lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 003: ID 062a:3633 MosArt Semiconductor Corp. Full-Speed Mouse
Bus 004 Device 002: ID 1b1c:1b39 Corsair Corsair Gaming K65 RGB RAPIDFIRE Keyboard 
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

# grep . /sys/bus/usb/devices/[0-9]*/power/control
/sys/bus/usb/devices/4-1/power/control:on
/sys/bus/usb/devices/4-2/power/control:on
/sys/bus/usb/devices/5-5/power/control:auto

Here mouse and keyboard are always powered on, but the CSR Bluetooth USB dongle is set to auto-suspend. If auto-suspend is enabled and it is causing trouble then one can test it by temporarily disabling it:

# echo on > /sys/bus/usb/devices/5-5/power/control
# cat /sys/bus/usb/devices/5-5/power/control
on

When this helps then one should disable it permanently and there are several ways to do this:

  • When you are already recompiling the kernel then it is likely best to disable it with the Bluetooth USB kernel module by setting the configuration parameter CONFIG_BT_HCIBTUSB_AUTOSUSPEND to N or by commenting it out in the kernel config file. This will cause the Bluetooth USB driver to disable auto-suspend by default for every port it finds a matching device on, and leaves all other USB devices as they were.

  • Without recompiling the kernel and where the Bluetooth USB module is compiled into the kernel does one need to do this with a boot parameter. For GRUB edit /etc/default/grub and append the kernel command line with btusb.enable_autosuspend=n. Then update the grub configuration by running update-grub and reboot.

File: /etc/default/grub

...
GRUB_CMDLINE_LINUX_DEFAULT="... btusb.enable_autosuspend=n"
...
  • Without recompiling the kernel and where the Bluetooth USB module is loadable should one create a file in /etc/modprobe.d/ to pass the parameter. Then either reboot, or, unplug the dongle and remove the kernel module with rmmod btusb and restart the module service with service systemd-modules-load restart before plugging the dongle back in again.

File: /etc/modprobe.d/bluetooth-usb.conf

options btusb enable_autosuspend=n

Addition: Enabling The Fast Connectable Setting

Another method for improving Bluetooth connectivity is to enable the FastConnectable setting of the bluetoothd daemon. The setting can be found in /etc/bluetooth/main.conf.

File: /etc/bluetooth/main.conf

...
# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
# however the tradeoff is increased power consumptions. This feature
# will fully work only on kernel version 4.1 and newer. Defaults to
# 'false'.
FastConnectable = true
...

Solution 2

I have this dongle - it's several years old so I can't comment on whether it's a fake or whether modern dongles with this USB ID can be fake.

Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I'm using it with a really old Acer TravelMate 2420 laptop using (out of necessity) the i386 release of Ubuntu 18.04 LTS. (Current kernel as of the time of writing is 4.15.0-106-generic. (No need to feel sympathy. This is just an old spare computer I keep in the bedroom and use occasionally.)

Bluetooth worked for me, but wasn't very reliable. I would get frequent disconnections of my Bluetooth mouse (Microsoft Bluetooth Notebook Mouse 5000).

I solved the problems completely a couple of weeks ago with the following changes in /etc/default/tlp:

# Exclude listed devices...
USB_BLACKLIST="0a12:0001"
# Bluetooth devices are excluded...
USB_BLACKLIST_BTUSB=1

(Find the appropriate lines and add the first and edit the second accordingly.)

It is likely that I don't need the specific ID-based USB_BLACKLIST command (I've not tested this) but thought I'd leave it in for safety. The second (USB_BLACKLIST_BTUSB) defaults to 0 on my system and I suspect this is the key configuration to change.

You may need to install the tlp package specifically, if it's not already installed. Don't forget to restart it after reconfiguring it.

I hope this helps.

Share:
25,494

Related videos on Youtube

Gryu
Author by

Gryu

Nothing special

Updated on September 18, 2022

Comments

  • Gryu
    Gryu almost 2 years

    My Bluetooth adapter does not work in Ubuntu.

    $ lsusb | grep tooth
    Bus 002 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
    

    $ hciconfig
    hci0:   Type: Primary  Bus: USB
        BD Address: 33:03:30:09:74:B4  ACL MTU: 360:4  SCO MTU: 0:0
        DOWN 
        RX bytes:1106 acl:0 sco:0 events:56 errors:0
        TX bytes:736 acl:0 sco:0 commands:60 errors:0
    

    $ sudo hciconfig hci0 up
    Can't init device hci0: Operation not supported (95)
    

    $ bluetoothctl
    Agent registered
    [bluetooth]# power on
    No default controller available
    

    $ hcitool dev
    Devices:
    $
    

    $ rfkill

    ID TYPE      DEVICE      SOFT      HARD
     0 bluetooth hci0   unblocked unblocked
     1 wlan      phy0   unblocked unblocked
    

    Tried the last two actions:

    Bluetake
    Works out-of-the-box in Ubuntu v10.04 ~ 11.04 but stopped working reliably in 11.10, frequent kernel panics and other general not good stuff, [Bug: 901770]

    $ lsusb <br>Bus 007 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

    $ hciconfig -a hci0 <br>Manufacturer: Cambridge Silicon Radio (10)

    Might need same fix as Belkin : add blacklist hci_usb to /etc/modprobe.d/blacklist.conf, and add hci_usb reset=1 to /etc/modules

    Also tried

    • to install kernel 5.5.2 kernel. But it failed to login, so I've purged it and returned to my 5.3.0-29-generic kernel.
    • to do the next, but it failed:
      $ make -C /lib/modules/$(uname -r)/build M=$PWD modules
      make: Entering directory '/usr/src/linux-headers-5.3.0-29-generic'
        CC [M]  /home/spacer/kernel/bluetooth/hci_vhci.o
      /home/spacer/kernel/bluetooth/hci_vhci.c: In function ‘vhci_create_device’:
      /home/spacer/kernel/bluetooth/hci_vhci.c:134:2: warning: dereferencing ‘void *’ pointer
        134 |  *skb_put(skb, 1) = 0xff;
            |  ^~~~~~~~~~~~~~~~
      /home/spacer/kernel/bluetooth/hci_vhci.c:134:19: error: invalid use of void expression
        134 |  *skb_put(skb, 1) = 0xff;
            |                   ^
      /home/spacer/kernel/bluetooth/hci_vhci.c:135:2: warning: dereferencing ‘void *’ pointer
        135 |  *skb_put(skb, 1) = dev_type;
            |  ^~~~~~~~~~~~~~~~
      /home/spacer/kernel/bluetooth/hci_vhci.c:135:19: error: invalid use of void expression
        135 |  *skb_put(skb, 1) = dev_type;
            |                   ^
      /home/spacer/kernel/bluetooth/hci_vhci.c: In function ‘vhci_get_user’:
      /home/spacer/kernel/bluetooth/hci_vhci.c:203:19: error: ‘HCI_BREDR’ undeclared (first use in this function)
        203 |   if (dev_type != HCI_BREDR && dev_type != HCI_AMP)
            |                   ^~~~~~~~~
      /home/spacer/kernel/bluetooth/hci_vhci.c:203:19: note: each undeclared identifier is reported only once for each function it appears in
      /home/spacer/kernel/bluetooth/hci_vhci.c: In function ‘vhci_open_timeout’:
      /home/spacer/kernel/bluetooth/hci_vhci.c:307:43: error: ‘HCI_BREDR’ undeclared (first use in this function)
        307 |  vhci_create_device(data, amp ? HCI_AMP : HCI_BREDR);
            |                                           ^~~~~~~~~
      /home/spacer/kernel/bluetooth/hci_vhci.c: At top level:
      /home/spacer/kernel/bluetooth/hci_vhci.c:352:3: error: ‘const struct file_operations’ has no member named ‘aio_write’
        352 |  .aio_write = vhci_write,
            |   ^~~~~~~~~
      /home/spacer/kernel/bluetooth/hci_vhci.c:352:15: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
        352 |  .aio_write = vhci_write,
            |               ^~~~~~~~~~
      /home/spacer/kernel/bluetooth/hci_vhci.c:352:15: note: (near initialization for ‘vhci_fops’)
      /home/spacer/kernel/bluetooth/hci_vhci.c:352:15: error: initialization of ‘ssize_t (*)(struct file *, const char *, size_t,  loff_t *)’ {aka ‘long int (*)(struct file *, const char *, long unsigned int,  long long int *)’} from incompatible pointer type ‘ssize_t (*)(struct kiocb *, const struct iovec *, long unsigned int,  loff_t)’ {aka ‘long int (*)(struct kiocb *, const struct iovec *, long unsigned int,  long long int)’} [-Werror=incompatible-pointer-types]
      /home/spacer/kernel/bluetooth/hci_vhci.c:352:15: note: (near initialization for ‘vhci_fops.write’)
      cc1: some warnings being treated as errors
      make[1]: *** [scripts/Makefile.build:290: /home/spacer/kernel/bluetooth/hci_vhci.o] Error 1
      make: *** [Makefile:1655: _module_/home/spacer/kernel/bluetooth] Error 2
      make: Leaving directory '/usr/src/linux-headers-5.3.0-29-generic'
      
  • Gryu
    Gryu over 4 years
    Yes, this adapter is problematic, but I hope, there's a solution. Maybe, on the kernel side.
  • Alex Vallo
    Alex Vallo over 4 years
    Somebody submitted a bug to kernel.org, but it has receive no attention. bugzilla.kernel.org/show_bug.cgi?id=205821
  • Alex Vallo
    Alex Vallo over 4 years
    Another kernel.org bug that is more active. bugzilla.kernel.org/show_bug.cgi?id=60824
  • Gryu
    Gryu over 4 years
    Yes, I've get bluetooth adapter to be detected using kernel recompilation with some modifications like yours, but it have not been able to pair it with my Redmi 6A. I didn't try other devices bluetooth speaker or other phone. So I don't know if it is solved or no now.
  • Gryu
    Gryu over 4 years
    I'm going to try your solution soon and will inform you if it works in my case.
  • Sven
    Sven over 4 years
    If you're still having trouble then disable auto-suspend on the USB port. Usually will a USB port suspend after 2 secs. It can interfere with USB devices (some mainboards do a full power off/on cycle). If the btusb module was compiled into the kernel then disable it with a boot option by editing /etc/default/grub: GRUB_CMDLINE_LINUX_DEFAULT="... btusb.enable_autosuspend=0" It can also be done with a parameter to modprobe for when the module is loadable, or for all and any USB port in general.
  • Boris Verkhovskiy
    Boris Verkhovskiy almost 4 years
    gotta love it when you buy a usb dongle and the first google result begins with "one needs to patch the kernel code"
  • PvdL
    PvdL over 3 years
    on Ubuntu 20.20, options btusb enable_autosuspend=n to /etc/modprobe.d/bluetooth-usb.conf was enough. modprobe -r did not work, (re)plug and play did.