蓝牙鼠标滞后 ubuntu 20.04

蓝牙鼠标滞后 ubuntu 20.04

我所说的“有时会滞后”是指它可以正常工作一分钟,然后断断续续几分钟,再次正常工作一分钟,然后断断续续等等。我已经尝试了很多已经给出的解决方案,例如编辑以添加/var/lib/bluetooth/mac-pc/mac-mouse/info连接参数以及另一个编辑单独文件的类似解决方案。

我还运行了一些诊断程序,信息如下。

我觉得最奇怪的是,当我运行蓝牙管理器并右键单击设置鼠标时,它会运行良好几秒钟,然后再次变得迟缓。还有另一种方法可以复制这种情况,即在终端中使用 hciconfig scan 命令使其运行顺畅几秒钟。

$ dmesg | grep -I blue

[   30.120183] Bluetooth: Core ver 2.22
[   30.120198] Bluetooth: HCI device and connection manager initialized
[   30.120201] Bluetooth: HCI socket layer initialized
[   30.120202] Bluetooth: L2CAP socket layer initialized
[   30.120204] Bluetooth: SCO socket layer initialized
[   31.395146] Bluetooth: hci0: BCM: chip id 70
[   31.396141] Bluetooth: hci0: BCM: features 0x06
[   31.412156] Bluetooth: hci0: dell-Inspiron-3543
[   31.416150] Bluetooth: hci0: BCM43142A0 (001.001.011) build 0341
[   34.019178] Bluetooth: hci0: BCM43142A0 (001.001.011) build 0341
[   34.035256] Bluetooth: hci0: BCM43142A0 Generic USB Class 2 NonUHE @ 20 MHz
[   39.041570] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   39.041572] Bluetooth: BNEP filters: protocol multicast
[   39.041575] Bluetooth: BNEP socket layer initialized
[   52.617208] Bluetooth: RFCOMM TTY layer initialized
[   52.617213] Bluetooth: RFCOMM socket layer initialized
[   52.617217] Bluetooth: RFCOMM ver 1.11
[   76.147097] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   76.147106] Bluetooth: HIDP socket layer initialized
[   76.150103] input: Bluetooth Mouse M336/M337/M535 Mouse as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0002/input/input21
[   76.150611] input: Bluetooth Mouse M336/M337/M535 Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0002/input/input22
[   76.150912] input: Bluetooth Mouse M336/M337/M535 Keyboard as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0002/input/input25
[   76.151558] hid-generic 0005:046D:B016.0002: input,hidraw1: BLUETOOTH HID v12.03 Mouse [Bluetooth Mouse M336/M337/M535] on ac:d1:b8:c3:50:48
[ 1862.205868] input: Bluetooth Mouse M336/M337/M535 Mouse as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0003/input/input26
[ 1862.206117] input: Bluetooth Mouse M336/M337/M535 Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0003/input/input27
[ 1862.206250] input: Bluetooth Mouse M336/M337/M535 Keyboard as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0003/input/input30
[ 1862.206567] hid-generic 0005:046D:B016.0003: input,hidraw1: BLUETOOTH HID v12.03 Mouse [Bluetooth Mouse M336/M337/M535] on ac:d1:b8:c3:50:48
[ 1983.198141] input: Bluetooth Mouse M336/M337/M535 Mouse as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0004/input/input31
[ 1983.198493] input: Bluetooth Mouse M336/M337/M535 Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0004/input/input32
[ 1983.198698] input: Bluetooth Mouse M336/M337/M535 Keyboard as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0004/input/input35
[ 1983.199155] hid-generic 0005:046D:B016.0004: input,hidraw1: BLUETOOTH HID v12.03 Mouse [Bluetooth Mouse M336/M337/M535] on ac:d1:b8:c3:50:48
[11971.835681] input: Bluetooth Mouse M336/M337/M535 Mouse as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0005/input/input36
[11971.836087] input: Bluetooth Mouse M336/M337/M535 Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0005/input/input37
[11971.836309] input: Bluetooth Mouse M336/M337/M535 Keyboard as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0005/input/input40
[11971.836838] hid-generic 0005:046D:B016.0005: input,hidraw1: BLUETOOTH HID v12.03 Mouse [Bluetooth Mouse M336/M337/M535] on ac:d1:b8:c3:50:48
[12319.290163] input: Bluetooth Mouse M336/M337/M535 Mouse as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0006/input/input41
[12319.290374] input: Bluetooth Mouse M336/M337/M535 Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0006/input/input42
[12319.290469] input: Bluetooth Mouse M336/M337/M535 Keyboard as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.6/1-1.6:1.0/bluetooth/hci0/hci0:11/0005:046D:B016.0006/input/input45
[12319.290724] hid-generic 0005:046D:B016.0006: input,hidraw1: BLUETOOTH HID v12.03 Mouse [Bluetooth Mouse M336/M337/M535] on ac:d1:b8:c3:50:48
$ sudo service bluetooth status

bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-03-02 10:40:40 IST; 24min ago
       Docs: man:bluetoothd(8)
   Main PID: 8765 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 9385)
     Memory: 1.2M
     CGroup: /system.slice/bluetooth.service
             └─8765 /usr/lib/bluetooth/bluetoothd

Mar 02 10:40:40 dell-Inspiron-3543 systemd[1]: Starting Bluetooth service...
Mar 02 10:40:40 dell-Inspiron-3543 bluetoothd[8765]: Bluetooth daemon 5.53
Mar 02 10:40:40 dell-Inspiron-3543 systemd[1]: Started Bluetooth service.
Mar 02 10:40:40 dell-Inspiron-3543 bluetoothd[8765]: Starting SDP server
Mar 02 10:40:40 dell-Inspiron-3543 bluetoothd[8765]: Bluetooth management interface 1.14 initialized
Mar 02 10:40:40 dell-Inspiron-3543 bluetoothd[8765]: Endpoint registered: sender=:1.34 path=/MediaEndpoint/A2DPSink/sbc
Mar 02 10:40:40 dell-Inspiron-3543 bluetoothd[8765]: Endpoint registered: sender=:1.34 path=/MediaEndpoint/A2DPSource/sbc
$ hciconfig scan

hci0:   Type: Primary  Bus: USB
    BD Address: AC:D1:B8:C3:50:48  ACL MTU: 1021:8  SCO MTU: 64:1
    UP RUNNING PSCAN ISCAN 
    RX bytes:1217978 acl:71784 sco:0 events:6538 errors:0
    TX bytes:85561 acl:61 sco:0 commands:5974 errors:0

答案1

通常,当我看到这种情况时,是因为蓝牙设备的电源管理设置太过激进。我最成功的解决方案是通过 禁用蓝牙设备的自动挂起功能btusb.enable_autosuspend

这是完成的方式:

  1. 打开终端(如果尚未打开)
  2. 编辑grub文件如下root
    sudo vi /etc/default/grub 
    
    笔记:如果您愿意,可以随意使用其他文本编辑器。
  3. 添加btusb.enable_autosuspend=0GRUB_CMDLINE_LINUX_DEFAULT行中。最终结果可能看起来像这样:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash btusb.enable_autosuspend=0"
    
    笔记:此行中可能包含更多项目,这没问题。您可以在引号之间的任何位置添加新标志,顺序无关紧要。
  4. 保存文件
  5. 更新 Grub:
    sudo update-grub
    
  6. 重启

这将禁用蓝牙无线电的省电模式。如果您不需要使用蓝牙并且希望减少耗电量,只需通过电源开关禁用蓝牙无线电即可。

答案2

我无法自行修复该问题,但我遇到了更多类似的问题,发现有人建议蓝牙使用与 wifi 相同的 2.4Gz 频段,这可能会导致此问题,而且这种方法有效。切换到以太网连接并立即关闭 wifi 可以解决我面临的大量延迟问题。

相关内容