You may find useful xinput list
and xinput test <device>
.
For example,
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Asus Laptop extra buttons id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
and I can monitor my keyboard (xinput test 10
) or touchpad (xinput test 11
, or even xinput test "SynPS/2 Synaptics TouchPad"
) for all kinds of input events, and they get pretty printed to console, and parameters get extracted and printed too.
This won't solve your problem, but at least will help a bit by deciphering the clutter which e.g. cat /dev/input/event1
produces.
Edit (from @alphanum in comments):
I wasn't really precise in my 10-year old answer... apologies. Enjoy this quick diagram:
┌─────────────────────┐ ┌─────────────────┐ ┌──────────────┐ ┌──────────────────┐
│ │ HID events │ │ xinput events │ │ │ │
│ HID/input device ├───────────►│ Device-specific ├──────────────►│ the kernel ├───►│ Userspace (apps) │
│ (e.g. USB keyboard) │ ▲ │ driver │ ▲ │ │ │ │
└─────────────────────┘ │ └─────────────────┘ │ └──────────────┘ └──────────────────┘
│ │
evtest /dev/input/XX xinput test <xinput id>
It shows 2 points:
- The results you get from
xinput test
are "xinput-unified"; i.e. processed by the device driver. These are more similar to what userspace apps see.
- The results you get from
evtest /dev/input/XX
are more "raw", not-yet-translated into xinput format. These are more similar to what your HID device will see.
Pertinent to whether you build a physical HID device, or an app, you may choose to use evtest
or xinput test
for debug. Comparing the 2 may also help troubleshoot device driver issues.
cat
you can useevtest
which gives nicely parsed info.