Step 1. Find the right input file, and record everything that comes across it. For example:
cat /dev/input/event5 | od -x
Step 2. Take the recording-file, and decode it with something like this: