Input Devices Stop Responding and High CPU Usage When Connecting USB Device

debianinputkdeudevxorg

I have been having this issue for a while now, but have no idea on how to debug it, so I'll report the details here:

Whenever I connect a USB Webcam, a Wacom graphic tablet or my Bluetooth headphones, the main xorg process starts using around 50% CPU usage and at the same time input devices start behaving strangely. The keyboard stops working completely, the mouse still works, but I can't click anywhere (either it doesn't react or it tries to move the window even when I click inside). Some random things like use the mousewheel over the workspace indicator to switch still works.

After rebooting or disconnecting the device and waiting a while everything returns to normal.

I am using Debian Testing with KDE and SDDM.

The .xsession-errors shows nothing related to this. The /var/log/Xorg.0.log is a bit odd as it mentions detecting a Keyboard (but I think this is unrelated, as the log for the wacom tablet looks normal):

[   652.297] (II) config/udev: Adding input device HD Pro Webcam C920 (/dev/input/event16)
[   652.297] (**) HD Pro Webcam C920: Applying InputClass "libinput keyboard catchall"
[   652.297] (II) Using input driver 'libinput' for 'HD Pro Webcam C920'
[   652.297] (**) HD Pro Webcam C920: always reports core events
[   652.297] (**) Option "Device" "/dev/input/event16"
[   652.297] (**) Option "_source" "server/udev"
[   652.298] (II) event16 - HD Pro Webcam C920: is tagged by udev as: Keyboard
[   652.298] (II) event16 - HD Pro Webcam C920: device is a keyboard
[   652.298] (II) event16 - HD Pro Webcam C920: device removed
[   652.360] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-4/1-4:1.0/input/input25/event16"
[   652.360] (II) XINPUT: Adding extended input device "HD Pro Webcam C920" (type: KEYBOARD, id 12)
[   652.360] (**) Option "xkb_model" "pc105"
[   652.360] (**) Option "xkb_layout" "de"
[   652.360] (WW) Option "xkb_variant" requires a string value
[   652.360] (WW) Option "xkb_options" requires a string value
[   652.361] (II) event16 - HD Pro Webcam C920: is tagged by udev as: Keyboard
[   652.361] (II) event16 - HD Pro Webcam C920: device is a keyboard
[   721.766] (II) config/udev: removing device HD Pro Webcam C920
[   721.766] (II) event16 - HD Pro Webcam C920: device removed

More things I noticed during debugging:

  • stace isn't helpful as finding anything "wrong" in thousands of lines per seconds is like a needle in a haystack
  • it is probably unrelated to this bug as I use a far newer kernel (5.2.0) and there is a normal amount of devices in /dev/input
  • when I switch to tty1 quickly before everything hangs, I can use it fine while the issue is occuring.
  • this way I noticed something new (as before htop froze before it occured): /usr/bin/kglobalaccel5 also has a really high CPU usage at the same time

Best Answer

The mystery is solved!

kglobalaccel5 made it far easier to research for this bug and indeed it has been reported on https://bugs.kde.org/show_bug.cgi?id=306352.

I looked in my home directory and indeed there was a .Xmodmap (last modified 4 years ago) lying around. I deleted it and after a reboot all devices are working fine again.

Related Question