udev rule for keyboard: which device is the one providing the data?

19 Views Asked by At

I am trying to set up an udev rule for an external keypad.

My udev rule looks like this:

ACTION=="add", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="xxxx", SUBSYSTEM=="input", SYMLINK+="keypad_%k", OWNER="my_user_name", RUN+="some_script.sh"

This works, the script is run and the links are created.

However, I get three devices:

lrwxrwxrwx 1 root root 13 Feb 28 13:10 keypad_event16 -> input/event16
lrwxrwxrwx 1 root root 13 Feb 28 13:10 keypad_event17 -> input/event17
lrwxrwxrwx 1 root root 13 Feb 28 13:10 keypad_event18 -> input/event18

which I think correspond to

> xinput --list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
   (...)
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳   USB Keyboard System Control             id=18   [slave  keyboard (3)]
    ↳   USB Keyboard Consumer Control           id=19   [slave  keyboard (3)]
    ↳   USB Keyboard                            id=20   [slave  keyboard (3)]

My questions are:

  • Out of interest: what are the "system control" and "consumer control" devices?

  • More importantly: how do I know which of my symlinks provides the actual keystroke data? This seems to be keypad_event16, but how do I know? Is it possible to modify the udev rule to create a symlink only for this one?

0

There are 0 best solutions below