]> git.scottworley.com Git - keystroke-timestamps/commitdiff
Call 1 EV_KEY
authorScott Worley <scottworley@scottworley.com>
Fri, 17 Sep 2021 22:16:04 +0000 (15:16 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 17 Sep 2021 22:16:04 +0000 (15:16 -0700)
keystroke-timestamps.c

index 73ce86ebecd3b393beac5a323d608f46b33294be..97936c6fca37741d8774271b0c25e032e562d2bc 100644 (file)
@@ -9,6 +9,12 @@
 #include <sys/select.h>
 #include <unistd.h>
 
+// This constant is defined in include/uapi/linux/input-event-codes.h
+#ifndef EV_KEY
+#define EV_KEY      0x01
+#endif
+
+
 int main (int argc, char **argv)
 {
   int print_usec = 0;
@@ -85,7 +91,7 @@ int main (int argc, char **argv)
         if (read_return != sizeof(i)) {
           errx(EX_IOERR, "Unexpected EOF");
         }
-        if (i.type == 1 && i.value == 1) {
+        if (i.type == EV_KEY && i.value == 1) {
           if (print_usec) {
             fprintf(output_file, "%ld.%06ld\n", i.time.tv_sec, i.time.tv_usec);
           } else {