Format of /Dev/Input/Event*

Format of /dev/input/event*

Right here in the module. You'll also need the module.

/dev/input keyboard format

/dev/input/by-path/platform-i8042-serio-0-event-kbd is just a symlink to /dev/input/eventX event device file. Data can be read from event device files as

struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;

defined in /usr/include/linux/input.h.

Possible values of type are prefixed with EV_.
Possible values of code depend on type. They are prefixed with KEY_ or BTN_ or REL_ or so on.
Possible values of value depend on both type and code. For example for key-press events value equals 1 and for key-release events 0.

You can examine event data with:

evtest /dev/input/eventX

where X is the event device number of your keyboard (or any other event device). One key press or release normally emits three events (EV_MSC, EV_KEY and EV_SYN).

What is the format of /dev/input/by-path/pci-xxx-kbd output?

I would guess that they are scan codes. This page lists the make and break codes of keys used by modern keyboards. For more information on PS/2 keyboard programming, see Adam Chapweske's resources.

Getting live info from /dev/input

This page: has a nice writeup on how to read the info from /dev/input/js0

The format of the events you read from the file are documented here: . It's a simple struct containing a timestamp, the event type and identifier and the value:

struct input_event {
struct timeval time;
unsigned short type;
unsigned short code;
unsigned int value;

Related Topics

Leave a reply