Como hacer que el driver de bluetooth jale en Ubunto 20.04

¿En qué podemos ayudarte?
< Regresar
Estás aquí:
Imprimir

Primero describire el problema:

La computadora con Ubuntu 20.04 no trae bluetooht integrado, compre un dongle por usb compatible con linux, al conectarlo lo reconoce pero no lo inicializa o no puede levantar el servicio.

Diagnostico

lsusb

Bus 002 Device 003: ID 1f75:0611 Innostor Technology Corporation
Bus 002 Device 002: ID 0bda:0411 Realtek
Semiconductor Corp. 4-Port USB 3.0 Hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub 
Bus 001 Device 004: ID 0c45:671e Microdia Integrated_Webcam_HD 
Bus 001 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) <--------
Bus 001 Device 002: ID 0bda:5411 Realtek Semiconductor Corp. 4-Port USB 2.0 Hub 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

dmesg | grep Bluetooth

[    8.154043] Bluetooth: Core ver 2.22
[    8.154090] Bluetooth: HCI device and connection manager initialized
[    8.154092] Bluetooth: HCI socket layer initialized
[    8.154094] Bluetooth: L2CAP socket layer initialized
[    8.154097] Bluetooth: SCO socket layer initialized
[    8.304553] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    8.304554] Bluetooth: BNEP filters: protocol multicast
[    8.304557] Bluetooth: BNEP socket layer initialized

dmesg | grep Bluetooth

[ 6.137963] Bluetooth: Core ver 2.22
[ 6.137977] Bluetooth: HCI device and connection manager initialized
[ 6.137980] Bluetooth: HCI socket layer initialized
[ 6.137982] Bluetooth: L2CAP socket layer initialized
[ 6.137984] Bluetooth: SCO socket layer initialized
[ 8.208995] Bluetooth: hci0: command 0x2003 tx timeout
[ 10.224994] Bluetooth: hci0: command 0x2007 tx timeout
[ 15.063638] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 15.063639] Bluetooth: BNEP filters: protocol multicast
[ 15.063642] Bluetooth: BNEP socket layer initialized
[ 1069.727317] Bluetooth: hci0: command 0x2003 tx timeout
[ 1071.743434] Bluetooth: hci0: command 0x2007 tx timeout
[ 1346.401282] Bluetooth: hci0: command 0x2003 tx timeout
[ 1348.417451] Bluetooth: hci0: command 0x2007 tx timeout
[ 1487.968981] Bluetooth: hci0: command 0x2003 tx timeout
[ 1489.984757] Bluetooth: hci0: command 0x2007 tx timeout
[ 2258.267934] Bluetooth: hci0: command 0x2003 tx timeout
[ 2260.287907] Bluetooth: hci0: command 0x2007 tx timeout

hciconfig -a hci0

hci0: Type: Primary Bus: USB
BD Address: 33:03:30:09:E8:9D ACL MTU: 360:4 SCO MTU: 0:0
DOWN 
RX bytes:3318 acl:0 sco:0 events:168 errors:0
TX bytes:2208 acl:0 sco:0 commands:180 errors:0
Features: 0xff 0xff 0xcd 0xfa 0xdb 0xbf 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
Link policy: RSWITCH HOLD SNIFF PARK 
Link mode: SLAVE ACCEPT 

sudo hciconfig hci0 up

Can't init device hci0: Operation not supported (95)

sudo btmon

Después del comando anterior en otra teminal ejecutar el siguiente comando

sudo hciconfig hci0 up

Delete Stored Link Key (0x03|0x0012) ncmd 1
        Status: Unsupported Feature or Parameter Value (0x11)

Si todo lo anterior se cumple entonces es un problema de que el adaptador de bluetooth no es CSR, entonces el driver no lo puede controlar y para resolver esta situación se tiene que hacer una modificacion al driver y recompilarlo.

Tareas a realizar:

Crear directorio temporal de trabajo

mkdir ~/build
cd ~/build

Descargar el kernel al directorio temporal

sudo apt-get source linux
sudo apt-get source linux-source  
sudo apt install linux-header-$(uname -r)

Validar que la version del kernel que se descargo

uname -a
5.4.0-44-generic #48-Ubuntu
ll ~/build
linux-5.4.0
linux_5.4.0-42.46.diff.gz
linux_5.4.0-42.46.dsc
linux_5.4.0.orig.tar.gz
linux-meta-5.4.0.42.46
linux-meta_5.4.0.42.46.dsc
linux-meta_5.4.0.42.46.tar.xz
++++No coinciden++++
+++++Vemos la version en que el driver se compilo, no concuerda con la que se descargo+++++
sudo modinfo btusb|grep vermagic
vermagic:       5.4.0-44-generic SMP mod_unload 

Modificar el makefile

cd ~/build/linux-5.4.0
sudo nano Makefile
line 4 SUBLEVEL = 0
line 5 EXTRAVERSION = -44-generic

Parchar el driver

sudo nano drivers/bluetooth/btusb.c
//buscar la linea completa
if (bcdDevice <= 0x100 || bcdDevice == 0x134)
//Comentarla para que quede
// if (bcdDevice <= 0x100 || bcdDevice == 0x134)
//buscar la linea completa
/* Detect controllers which aren't real CSR ones. */
if (le16_to_cpu(rp->manufacturer) != 10 ||
   le16_to_cpu(rp->lmp_subver) == 0x0c5c) {
//Modificarla para que quede
/* Detect controllers which aren't real CSR ones. */
/* if (le16_to_cpu(rp->manufacturer) != 10 ||
   le16_to_cpu(rp->lmp_subver) == 0x0c5c) */ {

Compilar

Antes de compilar hay que copiar un par de archivos

sudo cp /usr/src/linux-headers-$(uname -r)/.config ./
sudo cp /usr/src/linux-headers-$(uname -r)/Module.symvers Module.symvers
sudo make prepare
sudo make modules_prepare
sudo make M=drivers/bluetooth/

Respaldar el anterior

sudo cp /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko.bak 

Instalar nuevo driver

sudo cp drivers/bluetooth/btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth
sudo modinfo /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko
sudo modprobe -r btusb
sudo modprobe -v btusb

Esto se tiene que hacer cada vez que se actualiza el kernel

Table of Contents

Deja un comentario