1

I want to debug my keyboard and figure out what would happen after I press a key.

Is there any debug tools or solutions to track the keyboard events or handlers?

I searched the Internet and only found one useful answer (Debug/fix a key autorepeat issue?)

For example, I press a Volume control key, how does it trigger an event and control the driver to turn up/down?

And how do I track the control flow of it?

I'm using arch Linux on my laptop, so any solution for Linux is welcome.

Aaron Hall
  • 465
  • 4
  • 19
teable
  • 11
  • Look no further as this question has already been answered: https://superuser.com/questions/248517/show-keys-pressed-in-linux – Artem S. Tashkinov Jul 02 '20 at 06:58
  • See this answer for driver level. layers. Once you have an X event, applications grab the keyboard. See here how to debug this. The first candidate for Volume control keys etc. is your window manager (also as part of the Desktop environment). – dirkt Jul 02 '20 at 13:37
  • Promising solutions ! Thank you for your answers @dirkt and Artem S. Tashkinov. – teable Jul 04 '20 at 14:25

1 Answers1

1

You can observe raw USB events from the keyboard input device. Assuming you can find your keyboard here: ls /dev/input/by-id/*kbd, you can read events directly from that file.

An example where fmbtuinput.py prints human readable events:

sudo python fmbtuinput.py -p /dev/input/by-id/*kbd

This works for other USB input devices, too.