]> git.scottworley.com Git - keystroke-timestamps/blob - keystroke-timestamps.c
Initial version
[keystroke-timestamps] / keystroke-timestamps.c
1 #include <fcntl.h>
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <linux/input.h>
5
6 int main ()
7 {
8 struct input_event i;
9 int fd = open("/dev/input/by-path/platform-i8042-serio-0-event-kbd", O_RDONLY);
10 while (fd && read(fd, &i, sizeof(i)) == sizeof(i)) {
11 if (i.type == 1 && i.value == 1) {
12 printf("%ld.%ld\n", i.time.tv_sec, i.time.tv_usec);
13 fflush(stdout);
14 }
15 }
16 return 0;
17 }