InputConfiguration
Structure
Unless xorg.conf has manual configuration, X.org uses udev for detecting input devices, and udev properties for configuring them. This is what happens in detail:
- A hardware input device is present at boot, or gets hotplugged.
- The kernel detects this, and creates a new "input" device (e. g.
/sys/class/input/input3 and an "event" interface for it (/sys/class/input/event3 and a device node /dev/input/event3 which you can use to talk to the input device, see /usr/include/linux/input.h).
udev picks up the "add" event and the new device. /lib/udev/rules.d/60-persistent-input.rules calls /lib/udev/input_id on it, which detects the class of the device (mouse, touchpad, etc.) and attaches some properties to it:
$ /lib/udev/input_id /class/input/event4 ID_INPUT=1 ID_INPUT_KEY=1 ID_INPUT_KEYBOARD=1 $ /lib/udev/input_id /class/input/event14 ID_INPUT=1 ID_INPUT_MOUSE=1 ID_INPUT_TOUCHPAD=1
Existing flags:ID_INPUT
All input devices have this flag.
ID_INPUT_MOUSE
Touchscreens and tables have this flag as well, since by the type of events they can produce they act as a mouse.
ID_INPUT_TABLET
ID_INPUT_TOUCHSCREEN
ID_INPUT_JOYSTICK
ID_INPUT_KEY
Keyboards have this, but also things like lid switches or joystick which have just a few buttons
ID_INPUT_KEYBOARD