From: Scott Worley Date: Wed, 4 Sep 2013 18:04:37 +0000 (-0700) Subject: Initial version X-Git-Tag: v1.0.0~18 X-Git-Url: http://git.scottworley.com/keystroke-timestamps/commitdiff_plain/924be5081f9b06849ac0624f3af4a3ea7bc7ff12 Initial version --- 924be5081f9b06849ac0624f3af4a3ea7bc7ff12 diff --git a/keystroke-timestamps.c b/keystroke-timestamps.c new file mode 100644 index 0000000..670b43c --- /dev/null +++ b/keystroke-timestamps.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include + +int main () +{ + struct input_event i; + int fd = open("/dev/input/by-path/platform-i8042-serio-0-event-kbd", O_RDONLY); + while (fd && read(fd, &i, sizeof(i)) == sizeof(i)) { + if (i.type == 1 && i.value == 1) { + printf("%ld.%ld\n", i.time.tv_sec, i.time.tv_usec); + fflush(stdout); + } + } + return 0; +}