diff options
Diffstat (limited to 'src/test.c')
| -rw-r--r-- | src/test.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -27,8 +27,6 @@ static void loop_device(int fd) | |||
| 27 | { | 27 | { |
| 28 | struct Gestures gs; | 28 | struct Gestures gs; |
| 29 | struct MTouch mt; | 29 | struct MTouch mt; |
| 30 | const struct input_event *ev; | ||
| 31 | struct input_event event; | ||
| 32 | if (configure_mtouch(&mt, fd)) { | 30 | if (configure_mtouch(&mt, fd)) { |
| 33 | fprintf(stderr, "error: could not configure device\n"); | 31 | fprintf(stderr, "error: could not configure device\n"); |
| 34 | return; | 32 | return; |
| @@ -37,12 +35,12 @@ static void loop_device(int fd) | |||
| 37 | fprintf(stderr, "error: could not open device\n"); | 35 | fprintf(stderr, "error: could not open device\n"); |
| 38 | return; | 36 | return; |
| 39 | } | 37 | } |
| 40 | while (ev = get_iobuf_event(&mt.buf, fd)) { | 38 | while (poll_iobuf(&mt.buf, fd, 5000)) { |
| 41 | if (parse_event(&mt, ev)) { | 39 | while (read_packet(&mt, fd) > 0) { |
| 42 | extract_gestures(&gs, &mt); | 40 | extract_gestures(&gs, &mt); |
| 43 | output_gesture(&gs); | 41 | output_gesture(&gs); |
| 44 | } | 42 | } |
| 45 | if (mt_is_idle(&mt, fd)) { | 43 | if (has_delayed_gestures(&mt, fd)) { |
| 46 | extract_delayed_gestures(&gs, &mt); | 44 | extract_delayed_gestures(&gs, &mt); |
| 47 | output_gesture(&gs); | 45 | output_gesture(&gs); |
| 48 | } | 46 | } |
| @@ -56,7 +54,7 @@ int main(int argc, char *argv[]) | |||
| 56 | fprintf(stderr, "Usage: test <mtdev>\n"); | 54 | fprintf(stderr, "Usage: test <mtdev>\n"); |
| 57 | return -1; | 55 | return -1; |
| 58 | } | 56 | } |
| 59 | int fd = open(argv[1], O_RDONLY); | 57 | int fd = open(argv[1], O_RDONLY | O_NONBLOCK); |
| 60 | if (fd < 0) { | 58 | if (fd < 0) { |
| 61 | fprintf(stderr, "error: could not open file\n"); | 59 | fprintf(stderr, "error: could not open file\n"); |
| 62 | return -1; | 60 | return -1; |
