input_event structure description (from linux/input.h) input_event structure description (from linux/input.h) linux linux

input_event structure description (from linux/input.h)


The struct input_event is, among others, defined in include/linux/input.h.


From 5. Event interface in Linux kernel Documentation/input/input.txt (and modified to provide the correct header file names):

  • time is the timestamp, it returns the time at which the event happened.

  • type is for example EV_REL for relative moment, EV_KEY for a keypress orrelease. More types are defined in include/linux/input-event-codes.h.

  • code is event code, for example REL_X or KEY_BACKSPACE, again a completelist is in include/linux/input-event-codes.h.

  • value is the value the event carries. Either a relative change forEV_REL, absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY forrelease, 1 for keypress and 2 for autorepeat.

For guides and example code, do a web search for "linux kernel" "input subsystem".