如何让我的蓝牙设备正常工作?

pet*_*ter 6 usb bluetooth 19.04

我需要一些有关蓝牙问题的帮助。我无法使用 USB 蓝牙设备。蓝牙用户界面只是说没有适配器。

我正在运行 ubuntu 19.04,一切都是最新的。

根据 lsusb,我有这个设备,

Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Run Code Online (Sandbox Code Playgroud)

留言 | 蓝牙

[ 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
Run Code Online (Sandbox Code Playgroud)

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 
Run Code Online (Sandbox Code Playgroud)

须藤 hciconfig hci0 up

Can't init device hci0: Operation not supported (95)
Run Code Online (Sandbox Code Playgroud)

我不知道这里还能做什么?

有趣的是,我购买了这个设备,因为它说它可以与树莓派一起使用,所以我认为这意味着它也可以与其他 linux 发行版一起使用。而且这里提到,

https://elinux.org/RPi_USB_Bluetooth_adapters

小智 7

显然有很多假的CSR加密狗。Linux 有代码来处理它,但它似乎不适用于所有假加密狗。假的 bt Delete Stored Link Key功能的返回码错误。要查看您是否属于这种情况,请运行:

sudo btmon
Run Code Online (Sandbox Code Playgroud)

在一个终端中,当它运行时,运行

sudo hciconfig hci0 up
Run Code Online (Sandbox Code Playgroud)

btmon应在删除存储的链接密钥后显示错误,例如:

Status: Unsupported Feature or Parameter Value
Run Code Online (Sandbox Code Playgroud)

为了解决这个问题,我编辑btusb.c并重新编译了btusb.ko内核模块。将源代码放入当前目录:

apt-get source linux
Run Code Online (Sandbox Code Playgroud)

要构建和安装,请参阅此答案。您可能应该/lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko在覆盖之前进行备份。

我不得不注释掉 2 个if语句btusb.c以强制运行条件代码(如果可以,您可以尝试修复if语句),如下所示:

/* Fake CSR devices with broken commands */
// if (bcdDevice <= 0x100 || bcdDevice == 0x134)
Run Code Online (Sandbox Code Playgroud)

/* Detect controllers which aren't real CSR ones. */
/* if (le16_to_cpu(rp->manufacturer) != 10 ||
    le16_to_cpu(rp->lmp_subver) == 0x0c5c) */  {
Run Code Online (Sandbox Code Playgroud)

这个被黑的btusbmod 现在假设任何 CSR 都是假的,我的正在工作。我猜新的克隆使用不同的数字。不幸的是,btusb.ko每当我获得新内核时,我都必须复制或重建。


小智 2

在 Lenovo Yoga 900 上安装 19.04 后,我无法打开蓝牙适配器。我尝试了一些为旧版本 Ubuntu 建议的解决方案,但没有任何效果。

当我使用这些命令重新加载内核模块时,我的问题得到了解决。

sudo rmmod btusb
sudo modprobe btusb
sudo service bluetooth restart
Run Code Online (Sandbox Code Playgroud)

看来我每次重启后都需要这样做。