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.

3
  • Look no further as this question has already been answered: superuser.com/questions/248517/show-keys-pressed-in-linux Jul 2, 2020 at 6: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 2, 2020 at 13:37
  • Promising solutions ! Thank you for your answers @dirkt and Artem S. Tashkinov.
    – teable
    Jul 4, 2020 at 14:25

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.