蓝牙扫描在 Ubuntu 21.10 上未检测到任何设备

gwe*_*ydd 11 usb bluetooth realtek drivers 21.10

我刚买了一个TP-LINK蓝牙5.0 USB适配器(UB500),我查了一下,它的芯片是Realtek RTL8761B。它在 Windows 10 上工作得很好,但我在 Ubuntu 上遇到了问题。我正在运行 Ubuntu 21.10,并且刚刚升级到最新的稳定内核版本:5.14.14。在升级之前我尝试过这个解决方案但没有成功: https://linuxreviews.org/Realtek_RTL8761B

我已经尝试了在网上找到的几乎所有内容,但大多数解决方案都不适用,因为没有明显的问题:适配器似乎已正确安装并正常工作,但扫描未拾取任何蓝牙设备。我尝试过两个耳机(我知道它们可以正常工作)和我的手机,但没有成功。在手机上执行扫描时,即使我将计算机设置为可见,也不会显示计算机。

我不知道问题出在哪里。

    dmesg |grep -i bluetooth
    [    3.596913] Bluetooth: Core ver 2.22
    [    3.596935] NET: Registered PF_BLUETOOTH protocol family
    [    3.596936] Bluetooth: HCI device and connection manager initialized
    [    3.596939] Bluetooth: HCI socket layer initialized
    [    3.596941] Bluetooth: L2CAP socket layer initialized
    [    3.596945] Bluetooth: SCO socket layer initialized
    [   93.519895] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [   93.519899] Bluetooth: BNEP filters: protocol multicast
    [   93.519903] Bluetooth: BNEP socket layer initialized
    [  144.060814] Bluetooth: RFCOMM TTY layer initialized
    [  144.060821] Bluetooth: RFCOMM socket layer initialized
    [  144.060825] Bluetooth: RFCOMM ver 1.11
Run Code Online (Sandbox Code Playgroud)
    hciconfig -a
    hci0:    Type: Primary  Bus: USB
        BD Address: E8:48:B8:C8:20:00  ACL MTU: 1021:6  SCO MTU: 255:12
        UP RUNNING 
        RX bytes:4264 acl:0 sco:0 events:560 errors:0
        TX bytes:9000 acl:0 sco:0 commands:490 errors:0
        Features: 0xff 0xff 0xff 0xfe 0xdb 0xfd 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF PARK 
        Link mode: SLAVE ACCEPT 
        Name: 'gaia-ubuntu-desktop'
        Class: 0x7c0104
        Service Classes: Rendering, Capturing, Object Transfer, Audio, Telephony
        Device Class: Computer, Desktop workstation
        HCI Version: 5.1 (0xa)  Revision: 0xb
        LMP Version: 5.1 (0xa)  Subversion: 0x8761
        Manufacturer: Realtek Semiconductor Corporation (93)
Run Code Online (Sandbox Code Playgroud)
    rfkill list
    0: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
Run Code Online (Sandbox Code Playgroud)
    lsusb
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 004: ID 046d:0826 Logitech, Inc. HD Webcam C525
    Bus 003 Device 003: ID 04b8:013d Seiko Epson Corp. Epson Perfection V39
    Bus 003 Device 002: ID 0c76:2068 JMTek, LLC. USB MIC-SG01
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 003: ID 2357:0604 TP-Link TP%Link UB500 Adapter
    Bus 001 Device 002: ID 062a:3633 MosArt Semiconductor Corp. Full-Speed Mouse
    Bus 001 Device 004: ID 145f:0176 Trust Isla Keyboard
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Run Code Online (Sandbox Code Playgroud)
usb-devices | awk '/0604/' RS=
T:  Bus=01 Lev=01 Prnt=01 Port=07 Cnt=03 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2357 ProdID=0604 Rev=02.00
S:  Manufacturer= 
S:  Product=TP%Link UB500 Adapter
S:  SerialNumber=E848B8C82000
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#=0x1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
Run Code Online (Sandbox Code Playgroud)

小智 11

我在使用 Tp-Link UB500 适配器时遇到了同样的问题,我可以按照 Pilot6 的建议解决这个问题。请按照以下步骤操作。感谢飞行员6。

步骤1:下载并解压Linux内核源文件。

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.tar.xz
tar xpvf linux-5.11.tar.xz
Run Code Online (Sandbox Code Playgroud)

请务必根据您的系统使用内核版本(可以使用uname -r检查)

步骤2:编辑btusb.c

cd linux-5.11/drivers/bluetooth
gedit btusb.c
Run Code Online (Sandbox Code Playgroud)

添加以下内容

/* Tp-Link UB500 */
{ USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK },

Run Code Online (Sandbox Code Playgroud)

在“static const struct usb_device_id blacklist_table[]”部分下。在/*基于硅波的设备*/之后。

步骤3:编辑hci_ldisc.c

(某些版本的内核可能不需要 - 如果您不确定是否有必要,当尝试在步骤 4 中运行 make 时,它​​会变得很明显,因为编译器在分配时会抱怨指针类型不兼容hci_uart_tty_read

代替

static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
                 unsigned char __user *buf, size_t nr)
Run Code Online (Sandbox Code Playgroud)

static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
                 unsigned char __user *buf, size_t nr,
                 void **cookie, unsigned long offset)

Run Code Online (Sandbox Code Playgroud)

第四步:编译模块

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

如果您有安全启动,还需要对模块进行签名,搜索“如何为安全启动签名”。

步骤 5:更换旧模块

sudo cp btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth
Run Code Online (Sandbox Code Playgroud)

第 6 步:加载新的 btusb

sudo modprobe -r btusb
sudo modprobe -v btusb
Run Code Online (Sandbox Code Playgroud)

它对我有用!

  • 天哪,它成功了!太感谢了! (2认同)
  • 嗯,似乎在 Ubuntu 21.04 上对我不起作用。 (2认同)
  • 这可能很愚蠢,但请确保在源代码的 drivers/bluetooth 目录而不是顶级目录中执行步骤 4,否则会出现错误。考虑到这一点,这适用于 Ubuntu 20.04。我还根据@Laion的回答重新安装了固件。 (2认同)