summaryrefslogtreecommitdiff
path: root/tools/common-defs.h
blob: 0e08bc5b84d0f15c0f7ea79142e8f90e1a440a2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*****************************************************************************
 *
 * utouch-frame - Touch Frame Library
 *
 * Copyright (C) 2010-2011 Canonical Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Henrik Rydberg <rydberg@bitmath.org>
 *
 ****************************************************************************/

static void report_device_caps(utouch_frame_handle fh)
{
	const struct utouch_surface *s = utouch_frame_get_surface(fh);

	fprintf(stderr, "device props:\n");
	if (s->needs_pointer)
		fprintf(stderr, "\tpointer\n");
	if (s->is_direct)
		fprintf(stderr, "\tdirect\n");
	if (s->is_buttonpad)
		fprintf(stderr, "\tbuttonpad\n");
	if (s->is_semi_mt)
		fprintf(stderr, "\tsemi_mt\n");
	fprintf(stderr, "device mt events:\n");
	if (s->use_touch_major)
		fprintf(stderr, "\ttouch_major\n");
	if (s->use_touch_minor)
		fprintf(stderr, "\ttouch_minor\n");
	if (s->use_width_major)
		fprintf(stderr, "\twidth_major\n");
	if (s->use_width_minor)
		fprintf(stderr, "\twidth_minor\n");
	if (s->use_orientation)
		fprintf(stderr, "\torientation\n");
	if (s->use_pressure)
		fprintf(stderr, "\tpressure\n");
	if (s->use_distance)
		fprintf(stderr, "\tdistance\n");
}

static void report_frame(const struct utouch_frame *frame)
{
	int i;

	for (i = 0; i < frame->num_active; i++) {
		const struct utouch_contact *t = frame->active[i];

		fprintf(stderr, "touch %d\n", i);
		fprintf(stderr, "  slot:         %d\n", t->slot);
		fprintf(stderr, "  id:           %d\n", t->id);
		fprintf(stderr, "  tool_type:    %d\n", t->tool_type);
		fprintf(stderr, "  x:            %f\n", t->x);
		fprintf(stderr, "  y:            %f\n", t->y);
		fprintf(stderr, "  touch_major:  %f\n", t->touch_major);
		fprintf(stderr, "  touch_minor:  %f\n", t->touch_minor);
		fprintf(stderr, "  width_major:  %f\n", t->width_major);
		fprintf(stderr, "  width_minor:  %f\n", t->width_minor);
		fprintf(stderr, "  angle:        %f\n", t->orientation);
		fprintf(stderr, "  pressure:     %f\n", t->pressure);
		fprintf(stderr, "  distance:     %f\n", t->distance);
	}

	fprintf(stderr, "sync %d %ld %d %d %d\n",
		frame->num_active,
		frame->time,
		frame->sequence_id,
		frame->revision,
		frame->slot_revision);
}