我的蓝牙键盘存在滞后问题,只有使用电脑足够长的时间(几十或几百分钟)才能重现此问题。
症状:
- 键盘开始出现明显的输入延迟:按下键几秒钟后才出现字符,甚至可能丢失某些字符。
- 这似乎会影响所有程序(终端、浏览器、notepadqq,..)
系统和硬件:
- Ubuntu 22.04.2 LTS (Jammy Jellyfish) 在 HP Elitebook 笔记本电脑上运行
- 鼠标:Microsoft Surface Mouse(根据 Google 搜索,使用蓝牙 4.0)
- 键盘:MX Keys Mini(根据谷歌搜索,使用蓝牙 5.0)
- 蓝牙接收器内置(笔记本电脑内部),使用蓝牙版本 4.2。
调试细节:
我发现,当滞后开始
- 使用电源按钮关闭鼠标将消除键盘延迟暂时地. 如果鼠标再次通电(并重新连接),键盘将再次开始滞后。
- 重新启动键盘将消除键盘延迟(半)永久地(即直到问题再次出现)。
这里还有一些 dmesg 输出,其中我的注释以 开头---
:
$ sudo dmesg
...
[222409.820139] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.000D/input/input80
[222409.820356] input: Surface Mouse Consumer Control as /devices/virtual/misc/uhid/0005:045E:0919.000D/input/input81
[222409.820493] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.000D/input/input82
[222409.820698] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.000D/input/input83
[222409.820880] hid-generic 0005:045E:0919.000D: input,hidraw1: BLUETOOTH HID v1.32 Mouse [Surface Mouse] on 20:16:b9:d1:54:97
[222412.747962] input: MX Keys Mini Keyboard as /devices/virtual/misc/uhid/0005:046D:B369.000E/input/input85
[222412.749122] hid-generic 0005:046D:B369.000E: input,hidraw2: BLUETOOTH HID v0.04 Keyboard [MX Keys Mini] on 20:16:b9:d1:54:97
--- No problems here yet (starts somewhere down below, before 233992)
[222575.313702] input: Bose QC35 (AVRCP) as /devices/virtual/input/input87
[228493.379991] audit: type=1326 audit(1681644183.335:78): auid=1000 uid=1000 gid=1000 ses=2 subj=snap.snap-store.ubuntu-software pid=60040 comm="snap-store" exe="/snap/snap-store/638/usr/bin/snap-store" sig=0 arch=c000003e syscall=314 compat=0 ip=0x7f68cfea473d code=0x50000
[229528.103666] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[229528.110186] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[229553.586035] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[229553.590070] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
[229972.672035] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.000F/input/input88
[229972.672527] input: Surface Mouse Consumer Control as /devices/virtual/misc/uhid/0005:045E:0919.000F/input/input89
[229972.672736] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.000F/input/input90
[229972.672934] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.000F/input/input91
[229972.673168] hid-generic 0005:045E:0919.000F: input,hidraw1: BLUETOOTH HID v1.32 Mouse [Surface Mouse] on 20:16:b9:d1:54:97
[230011.566777] hp_wmi: Unknown event_id - 131073 - 0x0
--- The mouse was manually restarted here
[232350.405006] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.0010/input/input93
[232350.405835] input: Surface Mouse Consumer Control as /devices/virtual/misc/uhid/0005:045E:0919.0010/input/input94
[232350.406148] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.0010/input/input95
[232350.406466] input: Surface Mouse as /devices/virtual/misc/uhid/0005:045E:0919.0010/input/input96
[232350.406924] hid-generic 0005:045E:0919.0010: input,hidraw1: BLUETOOTH HID v1.32 Mouse [Surface Mouse] on 20:16:b9:d1:54:97
--- restart keyboard -> fixes the problem
[233992.420235] input: MX Keys Mini Keyboard as /devices/virtual/misc/uhid/0005:046D:B369.0011/input/input98
[233992.420490] hid-generic 0005:046D:B369.0011: input,hidraw2: BLUETOOTH HID v0.04 Keyboard [MX Keys Mini] on 20:16:b9:d1:54:97
蓝牙接收器
niko@niko-ubuntu-home:/var/tmp$ hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 20:16:B9:D1:54:97 ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING PSCAN ISCAN INQUIRY
RX bytes:91026274 acl:1090853 sco:13012 events:2628087 errors:0
TX bytes:166701082 acl:266103 sco:11767 commands:509565 errors:0
Features: 0xff 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'niko-ubuntu-home'
Class: 0x7c010c
Service Classes: Rendering, Capturing, Object Transfer, Audio, Telephony
Device Class: Computer, Laptop
HCI Version: 4.2 (0x8) Revision: 0x100
LMP Version: 4.2 (0x8) Subversion: 0x100
Manufacturer: Intel Corp. (2)
问题:
为什么连接的蓝牙鼠标会导致蓝牙键盘滞后?我该如何修复或调试这个问题?