How do I get my bluetooth device working?
Apparently there are a lot of fake CSR dongles. Linux has code to deal with it, but it doesn't seem to work with all fake dongles. The fake ones have a bad return code for bt Delete Stored Link Key function. To see if this is the case for you, run:
sudo btmon
in one terminal, and while it's running, run
sudo hciconfig hci0 up
and btmon
should show an error after Delete Stored Link Key like :
Status: Unsupported Feature or Parameter Value
To fix this, I edited btusb.c
and recompiled the btusb.ko
kernel module. To get the source code into the current directory:
apt-get source linux
To build and install, see this answer. You should probably back up /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko
before overwriting it.
I had to comment out 2 if
statements in btusb.c
to force the conditional code to run (you can try fixing if
statements if you're able), as such:
/* Fake CSR devices with broken commands */
// if (bcdDevice <= 0x100 || bcdDevice == 0x134)
and
/* Detect controllers which aren't real CSR ones. */
/* if (le16_to_cpu(rp->manufacturer) != 10 ||
le16_to_cpu(rp->lmp_subver) == 0x0c5c) */ {
This hacked btusb
mod now assumes any CSR is fake, and mine is working. I guess the new clones are using different numbers. Unfortunately I'll have to copy or rebuild btusb.ko
whenever I get a new kernel.
Thanks for you help answer user1020113 and damadam.
I got a couple of Bluetooth dongles which turned out to be fake and fixed them in the same way that you described here. It enables to system to take on any dongle and work with it.
It is very simple. I will try put everything together in simple-to-follow way.
Since you will be recompiling the btcusb.ko module, you will need to get the Linux source code so make sure that you are able to download the source code. To check that you are able to download the source code, run the following command:
software-properties-gtk and click the "source code" checkbox.
Once you are sure that you are set to download the source code, execute the following command. It will download the source code into your current directory, so make sure you are in a directory where you want this to be built.
apt source linux
This should create a directory $SOURCEDIR
of the same name as your kernel version and unpacks the source code into it.
Move to the directory in the current path:
cd $SOURCEDIR/drivers/bluetooth
Run the following:
make -C /lib/modules/$(uname -r)/build M=$(pwd) clean
cp /usr/src/linux-headers-$(uname -r)/.config ./
cp /usr/src/linux-headers-$(uname -r)/Module.symvers Module.symvers
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo cp /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko.bak
sudo cp btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth
sudo modprobe -r btusb
sudo modprobe -v btusb
If anything untoward happens, the above code has backed up the original btusb.ko to btusb.ko.bak so you can always revert it back.
Et voila. Enjoy! But remember, a fake device will act like a fake device.
After I installed 19.04 on my Lenovo Yoga 900 I was not able to turn on the bluetooth adapter. I tried some solutions that were suggested for older versions of Ubuntu, none worked.
When I used these commands to reload the kernel module my problem got fixed.
sudo rmmod btusb
sudo modprobe btusb
sudo service bluetooth restart
It seems that I need to do this after each reboot.