]> git.sesse.net Git - pistorm/blobdiff - input/input.c
support stealing the keyboard from the input layer
[pistorm] / input / input.c
index bc596073676bfb6060d1b25266b13ec9ba4334aa..c9201f98540b936d0dd46573ce75716c4358b71e 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/input.h>
+#include <sys/ioctl.h>
 #include <pthread.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -211,3 +212,15 @@ void pop_queued_key(uint8_t *c, uint8_t *t) {
   queued_keypresses--;
   return;
 }
+
+int grab_device(int fd) {
+  int rc = 0;
+  rc = ioctl(fd, EVIOCGRAB, (void *)1);
+  return rc;
+}
+
+int release_device(int fd) {
+  int rc = 0;
+  rc = ioctl(fd, EVIOCGRAB, (void *)0);
+  return rc;
+}