]> git.sesse.net Git - pistorm/blob - input/input.c
b0274e34366f08f4d6cb0aebb2467897e3a76d73
[pistorm] / input / input.c
1 #include <termios.h>
2 #include <unistd.h>
3 #include <linux/input.h>
4
5 int kbhit()
6 {
7   return 0;
8 }
9
10 extern int mouse_fd;
11
12 int get_mouse_status(char *x, char *y, char *b) {
13   struct input_event ie;
14   if (read(mouse_fd, &ie, sizeof(struct input_event)) != -1) {
15     *b = ((char *)&ie)[0];
16     *x = ((char *)&ie)[1];
17     *y = ((char *)&ie)[2];
18     return 1;
19   }
20
21   return 0;
22 }