Search notes:
/dev/input/eventX
/dev/input/eventX
represent event queues .
A /event/dev/eventX
«file» is created for each application collection
$ sudo libinput list-kernel-devices
/dev/input/event0: AT Translated Set 2 keyboard
/dev/input/event1: Sleep Button
/dev/input/event2: Lid Switch
/dev/input/event3: Power Button
/dev/input/event4: PC Speaker
/dev/input/event5: SYNA8004:00 06CB:CD8B Mouse
/dev/input/event6: TPPS/2 Elan TrackPoint
/dev/input/event7: LITEON Technology USB Multimedia Keyboard
/dev/input/event8: USB OPTICAL MOUSE
/dev/input/event9: Video Bus
/dev/input/event10: SYNA8004:00 06CB:CD8B Touchpad
/dev/input/event11: ThinkPad Extra Buttons
/dev/input/event12: sof-hda-dsp Mic
/dev/input/event13: sof-hda-dsp Headphone
/dev/input/event14: sof-hda-dsp HDMI/DP,pcm=3
/dev/input/event15: sof-hda-dsp HDMI/DP,pcm=4
/dev/input/event16: sof-hda-dsp HDMI/DP,pcm=5
Show events fired by mouse actions:
$ sudo libinput record /dev/input/event8
Device capabilities
The Python library
evdev
can be used to query an input device's capabilities:
import evdev
dev = evdev.InputDevice('/dev/input/event7')
caps = dev.capabilities(verbose=True)
for ev in caps:
print(ev)
for cap in caps[ev]:
print(' ' + str(cap))
#
# ('EV_SYN', 0)
# ('SYN_REPORT', 0)
# ('SYN_CONFIG', 1)
# …
# ('EV_KEY', 1)
# ('KEY_ESC', 1)
# ('KEY_1', 2)
# ('KEY_2', 3)
# …
# ('KEY_BACKSPACE', 14)
# ('KEY_TAB', 15)
# ('KEY_Q', 16)
# ('KEY_W', 17)
# ('KEY_E', 18)
# ('KEY_R', 19)
# ('KEY_T', 20)
# …
# ('EV_MSC', 4)
# ('MSC_SCAN', 4)
# ('EV_LED', 17)
# ('LED_NUML', 0)
# ('LED_CAPSL', 1)
# ('LED_SCROLLL', 2)
Blinkenlights
The device capabilites for the keyboard reported the three LEDs to indicate Num Lock , Caps Lock and Scroll Lock ).
The following Python script randomly turns them on and off:
import evdev
import time
import random
dev = evdev.InputDevice('/dev/input/event7')
for i in range (20):
dev.set_led(evdev.ecodes.LED_NUML , random.choice ([0, 1]))
dev.set_led(evdev.ecodes.LED_CAPSL , random.choice ([0, 1]))
dev.set_led(evdev.ecodes.LED_SCROLLL, random.choice ([0, 1]))
time.sleep(0.6)
TODO
evemu-…
evemu-describe gathers information about the input device and prints it to stdout. This information can be parsed by
evemu-device to create a virtual input device with the same properties.
evemu-record
captures events from the input device and prints them to stdout. The events can be parsed by evemu-play
to let a virtual input device created with evemu-device
emit the exact same event sequence.
$ sudo evemu-describe /dev/input/event0
$ sudo evemu-describe /dev/input/event8
See also
CONFIG_INPUT_EVDEV
is required in order for input events to be accessible under /dev/input/eventX
.
Links
evemu records and replays device descriptions and events, making it possible to emulate input devices through the kernel's input system.