7 #include <linux/input.h>
11 int main(int ac, char **av)
14 if( ac < 2 ) { printf("usage: %s /dev/input/by-id/<device?>\n", av[0]); exit(1); }
15 int fd = open(av[1], O_RDONLY);
16 if( !fd ) { perror(av[1]); exit(1); }
19 int ret = read(fd, &ev, sizeof(ev));
20 if( ret != sizeof(ev) ) {
21 if( ret < 0 ) perror("read event");
22 printf("bad read: %d\n", ret);
25 printf("event: (%d, %d, 0x%x)\n", ev.type, ev.code, ev.value);