diff options
Diffstat (limited to 'test/touch.c')
| -rw-r--r-- | test/touch.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/touch.c b/test/touch.c index 48b2f12..1f9213d 100644 --- a/test/touch.c +++ b/test/touch.c | |||
| @@ -28,11 +28,17 @@ | |||
| 28 | #include <unistd.h> | 28 | #include <unistd.h> |
| 29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| 30 | 30 | ||
| 31 | static void tp_sync(struct touch_engine *engine, touch_time_t time) | 31 | static void tp_event(struct touch_engine *engine, |
| 32 | const struct input_event *ev) | ||
| 33 | { | ||
| 34 | fprintf(stderr, "event %d %d %d\n", ev->type, ev->code, ev->value); | ||
| 35 | } | ||
| 36 | |||
| 37 | static void tp_sync(struct touch_engine *engine) | ||
| 32 | { | 38 | { |
| 33 | struct touch_frame *frame = &engine->frame; | 39 | struct touch_frame *frame = &engine->frame; |
| 34 | int slot, i; | 40 | int slot, i; |
| 35 | fprintf(stderr, "sync %d %lld\n", frame->ntouch, time); | 41 | fprintf(stderr, "sync %d %lld\n", frame->ntouch, frame->time); |
| 36 | for (slot = frame->slot; slot >= 0; slot = next_slot(frame, slot)) { | 42 | for (slot = frame->slot; slot >= 0; slot = next_slot(frame, slot)) { |
| 37 | struct touch *touch = &frame->touch[slot]; | 43 | struct touch *touch = &frame->touch[slot]; |
| 38 | fprintf(stderr, "touch %d\n", slot); | 44 | fprintf(stderr, "touch %d\n", slot); |
| @@ -44,7 +50,7 @@ static void tp_sync(struct touch_engine *engine, touch_time_t time) | |||
| 44 | static void loop_device(struct touch_dev *dev, int fd) | 50 | static void loop_device(struct touch_dev *dev, int fd) |
| 45 | { | 51 | { |
| 46 | struct touch_engine engine; | 52 | struct touch_engine engine; |
| 47 | touch_engine_init(&engine, tp_sync, 0); | 53 | touch_engine_init(&engine, tp_event, tp_sync, 0); |
| 48 | touch_engine_attach(&engine, dev); | 54 | touch_engine_attach(&engine, dev); |
| 49 | while (!touch_dev_idle(dev, fd, 5000)) | 55 | while (!touch_dev_idle(dev, fd, 5000)) |
| 50 | touch_dev_pull(dev, fd); | 56 | touch_dev_pull(dev, fd); |
