diff options
Diffstat (limited to 'test/grail-touch.c')
| -rw-r--r-- | test/grail-touch.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/test/grail-touch.c b/test/grail-touch.c index bed31c3..c5ecae3 100644 --- a/test/grail-touch.c +++ b/test/grail-touch.c | |||
| @@ -28,22 +28,33 @@ | |||
| 28 | #include <unistd.h> | 28 | #include <unistd.h> |
| 29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| 30 | 30 | ||
| 31 | static void tp_event(struct touch_engine *engine, | 31 | static void tp_event(struct touch_dev *dev, |
| 32 | const struct input_event *ev) | 32 | const struct input_event *ev) |
| 33 | { | 33 | { |
| 34 | fprintf(stderr, "event %d 0x%x %d\n", ev->type, ev->code, ev->value); | 34 | fprintf(stderr, "event %d 0x%x %d\n", ev->type, ev->code, ev->value); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static void tp_sync(struct touch_engine *engine, | 37 | static void tp_sync(struct touch_dev *dev, |
| 38 | const struct input_event *syn) | 38 | const struct input_event *syn) |
| 39 | { | 39 | { |
| 40 | struct touch_frame *frame = &engine->frame; | 40 | struct touch_frame *frame = &dev->frame; |
| 41 | int i, j; | 41 | int i, j; |
| 42 | for (i = 0; i < frame->nactive; i++) { | 42 | for (i = 0; i < frame->nactive; i++) { |
| 43 | struct touch *t = frame->active[i]; | 43 | struct touch *t = frame->active[i]; |
| 44 | fprintf(stderr, "touch %d %d\n", i, t->slot); | 44 | fprintf(stderr, "touch %d\n", i); |
| 45 | for (j = 0; j < DIM_TOUCH_PROP; j++) | 45 | fprintf(stderr, " slot: %d\n", t->slot); |
| 46 | fprintf(stderr, " %d\n", t->prop[j]); | 46 | fprintf(stderr, " id: %d\n", t->id); |
| 47 | fprintf(stderr, " tool_type: %d\n", t->tool_type); | ||
| 48 | fprintf(stderr, " x: %d\n", t->x); | ||
| 49 | fprintf(stderr, " y: %d\n", t->y); | ||
| 50 | fprintf(stderr, " touch_major: %d\n", t->touch_major); | ||
| 51 | fprintf(stderr, " touch_minor: %d\n", t->touch_minor); | ||
| 52 | fprintf(stderr, " width_major: %d\n", t->width_major); | ||
| 53 | fprintf(stderr, " width_minor: %d\n", t->width_minor); | ||
| 54 | fprintf(stderr, " angle: %f\n", | ||
| 55 | touch_angle(dev, t->orientation)); | ||
| 56 | fprintf(stderr, " pressure: %f\n", | ||
| 57 | touch_pressure(dev, t->pressure)); | ||
| 47 | } | 58 | } |
| 48 | fprintf(stderr, "sync %d %lld %d %d\n", | 59 | fprintf(stderr, "sync %d %lld %d %d\n", |
| 49 | frame->nactive, frame->time, frame->ncreate, frame->ndestroy); | 60 | frame->nactive, frame->time, frame->ncreate, frame->ndestroy); |
| @@ -51,12 +62,10 @@ static void tp_sync(struct touch_engine *engine, | |||
| 51 | 62 | ||
| 52 | static void loop_device(struct touch_dev *dev, int fd) | 63 | static void loop_device(struct touch_dev *dev, int fd) |
| 53 | { | 64 | { |
| 54 | struct touch_engine engine; | 65 | dev->event = tp_event; |
| 55 | touch_engine_init(&engine, tp_event, tp_sync, 0); | 66 | dev->sync = tp_sync; |
| 56 | touch_engine_attach(&engine, dev); | ||
| 57 | while (!touch_dev_idle(dev, fd, 5000)) | 67 | while (!touch_dev_idle(dev, fd, 5000)) |
| 58 | touch_dev_pull(dev, fd); | 68 | touch_dev_pull(dev, fd); |
| 59 | touch_engine_detach(&engine, dev); | ||
| 60 | } | 69 | } |
| 61 | 70 | ||
| 62 | int main(int argc, char *argv[]) | 71 | int main(int argc, char *argv[]) |
