Score:0

Bluetooth keyboard input lag? (goes away if bluetooth mouse disconnected) Ubuntu 22.04

cn flag
np8

I have a lagging problem with a bluetooth keyboard which I can only reproduce by using my computer for enough time (some tens or hundreds of minutes).

Symptoms:

  • The keyboard starts to have significant input lag: The characters come even seconds later the keys have been pressed, and some characters may be even lost.
  • This seems to affect all programs (terminal, browser, notepadqq,..)

System & HW:

  • Ubuntu 22.04.2 LTS (Jammy Jellyfish) running on HP Elitebook laptop
  • Mouse: Microsoft Surface Mouse (Which based on Google search uses Bluetooth 4.0)
  • Keyboard: MX Keys Mini (Which based on Google search uses Bluetooth 5.0)
  • The bluetooth receiver is built in (inside the laptop), using Bluetooth version 4.2.

Debugging details:

I have found out, that when the lagging starts

  • Shutting down the mouse with it's power button will remove the keyboard lag temporarily. The keyboard starts lagging again if mouse is powered again (and reconnected).
  • Rebooting the keyboard will remove the keyboard lag (semi-)permanently (i.e. until the problem occurs again).

Here's also some dmesg output with my comments starting with --- :

$ 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

Bluetooth receiver

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)

Question:

Why would a connected bluetooth mouse make a bluetooth keyboard lag? How can I fix or debug this..?

David avatar
cn flag
Where is the Bluetooth receiver on the computer, a dongle or built in? Are both the mouse and keyboard the same Bluetooth version? Is the Bluetooth on the computer the same version as the mouse and keyboard?
np8 avatar
cn flag
np8
Added some details to the question. How would I check the version of the bluetooth of the keyboard?
David avatar
cn flag
The product docs or makers web site.
np8 avatar
cn flag
np8
I searched the mouse and keyboard bluetooth version from Google and updated the question. I also tried to use `hcitool` to show some info but I could not make it show my devices (not sure if connected to this problem or not)
Matthias Lenmher avatar
nl flag
have you tried to change or charge the bluetooth keyboard batteries?, in some situations (due to radio information transmission) this may work with that.
np8 avatar
cn flag
np8
The keyboard has a built-in batttery. The charge level of the keyboard does not have to have any effect on the lag.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.