文档
https://www.kernel.org/doc/html/v4.17/input/event-codes.html
查看
ls /dev/input/event*
显示
cat /proc/bus/input/devices
示例
fd = open("/dev/input/event1", O_RDWR);
ret = read(fd, &value, sizeof(value));
printf("%d %d %d\n", value.type,value.code, value.value);
数据
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
+ 16 + 2 + 2 + 4 +
| sec + µsec | | | |
+-----------------------------------------------------------------------+
| 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|
+-----------------------------------------------------------------------+
| | | | |
+ timeval +type + code+ value +
事件
EV_SYN
EV_KEY
EV_REL
EV_ABS
EV_LED
EV_SND
EV_REP
EV_PWR