summaryrefslogtreecommitdiff
path: root/test/touch.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@bitmath.org>2010-07-20 15:39:08 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-05 22:48:38 +0200
commiteb896e11aacab5f53e3915a8d19ffffd92ce8e10 (patch)
treea2b12258c1697e61854704a0eff14070bc9fa963 /test/touch.c
parent3b9c20f869a2f55bd9953665c9e7fd713db4ff43 (diff)
Touch API changes
Add touch time to the touch frame (Thanks Rafi) Add touch change counters to the touch frame Add event bypass callback Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'test/touch.c')
-rw-r--r--test/touch.c12
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
31static void tp_sync(struct touch_engine *engine, touch_time_t time) 31static 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
37static 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)
44static void loop_device(struct touch_dev *dev, int fd) 50static 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);