summaryrefslogtreecommitdiff
path: root/tools/utouch-frame-test-mtdev.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2011-02-16 18:07:57 +0100
committerHenrik Rydberg <rydberg@euromail.se>2011-02-16 18:07:57 +0100
commit7864e778cc10dbc2b0064f0f1953ef5389f0d68b (patch)
tree6d3505d33fdf0448a8c7ea8dbddc52a75b7abbfc /tools/utouch-frame-test-mtdev.c
parent9394c8edc39063f4462bbfedbd4225f6c1aebc98 (diff)
Break out common display functions
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'tools/utouch-frame-test-mtdev.c')
-rw-r--r--tools/utouch-frame-test-mtdev.c62
1 files changed, 2 insertions, 60 deletions
diff --git a/tools/utouch-frame-test-mtdev.c b/tools/utouch-frame-test-mtdev.c
index 86f5b64..4838f84 100644
--- a/tools/utouch-frame-test-mtdev.c
+++ b/tools/utouch-frame-test-mtdev.c
@@ -30,6 +30,7 @@
30#include <stdio.h> 30#include <stdio.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include "common-defs.h"
33 34
34struct frame_test { 35struct frame_test {
35 struct evemu_device *evemu; 36 struct evemu_device *evemu;
@@ -69,36 +70,6 @@ static void destroy_all(struct frame_test *test)
69 memset(test, 0, sizeof(*test)); 70 memset(test, 0, sizeof(*test));
70} 71}
71 72
72static void report_frame(const struct utouch_frame *frame)
73{
74 int i;
75
76 for (i = 0; i < frame->num_active; i++) {
77 const struct utouch_contact *t = frame->active[i];
78
79 fprintf(stderr, "touch %d\n", i);
80 fprintf(stderr, " slot: %d\n", t->slot);
81 fprintf(stderr, " id: %d\n", t->id);
82 fprintf(stderr, " tool_type: %d\n", t->tool_type);
83 fprintf(stderr, " x: %f\n", t->x);
84 fprintf(stderr, " y: %f\n", t->y);
85 fprintf(stderr, " touch_major: %f\n", t->touch_major);
86 fprintf(stderr, " touch_minor: %f\n", t->touch_minor);
87 fprintf(stderr, " width_major: %f\n", t->width_major);
88 fprintf(stderr, " width_minor: %f\n", t->width_minor);
89 fprintf(stderr, " angle: %f\n", t->orientation);
90 fprintf(stderr, " pressure: %f\n", t->pressure);
91 fprintf(stderr, " distance: %f\n", t->distance);
92 }
93
94 fprintf(stderr, "sync %d %ld %d %d %d\n",
95 frame->num_active,
96 frame->time,
97 frame->sequence_id,
98 frame->revision,
99 frame->slot_revision);
100}
101
102static void loop_device(struct frame_test *test, int fd) 73static void loop_device(struct frame_test *test, int fd)
103{ 74{
104 const struct utouch_frame *frame; 75 const struct utouch_frame *frame;
@@ -113,35 +84,6 @@ static void loop_device(struct frame_test *test, int fd)
113 } 84 }
114} 85}
115 86
116static void report_device_caps(struct frame_test *test)
117{
118 struct utouch_surface *s = utouch_frame_get_surface(test->fh);
119 fprintf(stderr, "device props:\n");
120 if (s->needs_pointer)
121 fprintf(stderr, "\tpointer\n");
122 if (s->is_direct)
123 fprintf(stderr, "\tdirect\n");
124 if (s->is_buttonpad)
125 fprintf(stderr, "\tbuttonpad\n");
126 if (s->is_semi_mt)
127 fprintf(stderr, "\tsemi_mt\n");
128 fprintf(stderr, "device mt events:\n");
129 if (s->use_touch_major)
130 fprintf(stderr, "\ttouch_major\n");
131 if (s->use_touch_minor)
132 fprintf(stderr, "\ttouch_minor\n");
133 if (s->use_width_major)
134 fprintf(stderr, "\twidth_major\n");
135 if (s->use_width_minor)
136 fprintf(stderr, "\twidth_minor\n");
137 if (s->use_orientation)
138 fprintf(stderr, "\torientation\n");
139 if (s->use_pressure)
140 fprintf(stderr, "\tpressure\n");
141 if (s->use_distance)
142 fprintf(stderr, "\tdistance\n");
143}
144
145int main(int argc, char *argv[]) 87int main(int argc, char *argv[])
146{ 88{
147 struct frame_test test; 89 struct frame_test test;
@@ -182,7 +124,7 @@ int main(int argc, char *argv[])
182 return -1; 124 return -1;
183 } 125 }
184 126
185 report_device_caps(&test); 127 report_device_caps(test.fh);
186 128
187 loop_device(&test, fd); 129 loop_device(&test, fd);
188 130