Instructions how to capture keyboard and mouse events and turn them into human readable output.
- Run
evtest
without any argments and see which event device you need to use. - Run the following command for the keyboard events:
evtest /dev/input/event5 | grep --line-buffered 'EV_KEY' | sed -r -e 's/.*\(KEY_/Keyboard: /' -e 's/\), value 0/ - UP/' -e 's/\), value 1/ - DOWN/' -e 's/\), value 2/ - HOLD/'
Example of the output:
Keyboard: Z - DOWN
Keyboard: Z - UP
Keyboard: SPACE - DOWN
Keyboard: SPACE - HOLD
Keyboard: SPACE - HOLD
Keyboard: SPACE - HOLD
Keyboard: SPACE - UP
Keyboard: LEFTCTRL - DOWN
Keyboard: LEFTCTRL - HOLD
Keyboard: LEFTCTRL - HOLD
Keyboard: LEFTCTRL - HOLD
Keyboard: LEFTCTRL - UP
- Run the following command for the mouse events:
evtest /dev/input/event7 | egrep --line-buffered '(EV_KEY|REL_WHEEL_HI_RES)' | sed -r -e 's/.*\((BTN_|REL_WHEEL_HI_RES)/Mouse: /' -e 's/\), value -120/WHEEL - DOWN/' -e 's/\), value 120/WHEEL - UP/' -e 's/\), value 0/ - UP/' -e 's/\), value 1/ - DOWN/' -e 's/\), value 2/ - HOLD/'
Example of the output:
Mouse: WHEEL - UP
Mouse: WHEEL - UP
Mouse: WHEEL - UP
Mouse: LEFT - DOWN
Mouse: LEFT - UP
Mouse: MIDDLE - DOWN
Mouse: MIDDLE - UP
Mouse: RIGHT - DOWN
Mouse: RIGHT - UP
Mouse: WHEEL - DOWN
Mouse: WHEEL - DOWN
Mouse: WHEEL - DOWN