summaryrefslogtreecommitdiff
path: root/tools/common-defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/common-defs.h')
-rw-r--r--tools/common-defs.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/tools/common-defs.h b/tools/common-defs.h
new file mode 100644
index 0000000..0e08bc5
--- /dev/null
+++ b/tools/common-defs.h
@@ -0,0 +1,83 @@
1/*****************************************************************************
2 *
3 * utouch-frame - Touch Frame Library
4 *
5 * Copyright (C) 2010-2011 Canonical Ltd.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * Authors:
21 * Henrik Rydberg <rydberg@bitmath.org>
22 *
23 ****************************************************************************/
24
25static void report_device_caps(utouch_frame_handle fh)
26{
27 const struct utouch_surface *s = utouch_frame_get_surface(fh);
28
29 fprintf(stderr, "device props:\n");
30 if (s->needs_pointer)
31 fprintf(stderr, "\tpointer\n");
32 if (s->is_direct)
33 fprintf(stderr, "\tdirect\n");
34 if (s->is_buttonpad)
35 fprintf(stderr, "\tbuttonpad\n");
36 if (s->is_semi_mt)
37 fprintf(stderr, "\tsemi_mt\n");
38 fprintf(stderr, "device mt events:\n");
39 if (s->use_touch_major)
40 fprintf(stderr, "\ttouch_major\n");
41 if (s->use_touch_minor)
42 fprintf(stderr, "\ttouch_minor\n");
43 if (s->use_width_major)
44 fprintf(stderr, "\twidth_major\n");
45 if (s->use_width_minor)
46 fprintf(stderr, "\twidth_minor\n");
47 if (s->use_orientation)
48 fprintf(stderr, "\torientation\n");
49 if (s->use_pressure)
50 fprintf(stderr, "\tpressure\n");
51 if (s->use_distance)
52 fprintf(stderr, "\tdistance\n");
53}
54
55static void report_frame(const struct utouch_frame *frame)
56{
57 int i;
58
59 for (i = 0; i < frame->num_active; i++) {
60 const struct utouch_contact *t = frame->active[i];
61
62 fprintf(stderr, "touch %d\n", i);
63 fprintf(stderr, " slot: %d\n", t->slot);
64 fprintf(stderr, " id: %d\n", t->id);
65 fprintf(stderr, " tool_type: %d\n", t->tool_type);
66 fprintf(stderr, " x: %f\n", t->x);
67 fprintf(stderr, " y: %f\n", t->y);
68 fprintf(stderr, " touch_major: %f\n", t->touch_major);
69 fprintf(stderr, " touch_minor: %f\n", t->touch_minor);
70 fprintf(stderr, " width_major: %f\n", t->width_major);
71 fprintf(stderr, " width_minor: %f\n", t->width_minor);
72 fprintf(stderr, " angle: %f\n", t->orientation);
73 fprintf(stderr, " pressure: %f\n", t->pressure);
74 fprintf(stderr, " distance: %f\n", t->distance);
75 }
76
77 fprintf(stderr, "sync %d %ld %d %d %d\n",
78 frame->num_active,
79 frame->time,
80 frame->sequence_id,
81 frame->revision,
82 frame->slot_revision);
83}