I've been playing around with capturing the input from my keyboard device:
/dev/input/by-path/platform-i8042-serio-0-event-kbd
for me, and I was wondering if there was any specification for what it returns, using
od -tx1 /dev/input/by-path/platform-i8042-serio-0-event-kbd
to listen. I'm curious mostly due to the behavior of certain keys; the meta, arrow keys, numpad forward slash.
0520300 ac 9d 86 4c 6b 0f 04 00 04 00 04 00 (db) 00 00 00
0520320 ac 9d 86 4c 8c 0f 04 00 01 00 (7d) 00 00 00 00 00
0520340 ac 9d 86 4c 95 0f 04 00 00 00 00 00 00 00 00 00
Every other key I've looked at so far has the two bytes in parentheses as matching values, is there any reason these are special?
/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 asdefined in
/usr/include/linux/input.h
.Possible values of
type
are prefixed withEV_
. Possible values ofcode
depend ontype
. They are prefixed withKEY_
orBTN_
orREL_
or so on. Possible values ofvalue
depend on bothtype
andcode
. For example for key-press eventsvalue
equals1
and for key-release events0
.You can examine event data with:
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
andEV_SYN
).