From 924be5081f9b06849ac0624f3af4a3ea7bc7ff12 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 4 Sep 2013 11:04:37 -0700 Subject: [PATCH] Initial version --- keystroke-timestamps.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 keystroke-timestamps.c 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; +} -- 2.51.2