summaryrefslogtreecommitdiff
path: root/include/mtdev-mapping.h
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-06-17 18:12:58 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-06-17 18:12:58 +0200
commit66e5de9eaefc33ffa6af3617f9ec7a50f10af50d (patch)
tree66535311e0b9c422b30341237fd596fb9ebbdd75 /include/mtdev-mapping.h
Initial load of mtdev project
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'include/mtdev-mapping.h')
-rw-r--r--include/mtdev-mapping.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/include/mtdev-mapping.h b/include/mtdev-mapping.h
new file mode 100644
index 0000000..67fa06e
--- /dev/null
+++ b/include/mtdev-mapping.h
@@ -0,0 +1,76 @@
1/*****************************************************************************
2 *
3 * mtdev - MT device event converter (MIT license)
4 *
5 * Copyright (C) 2010 Henrik Rydberg <rydberg@euromail.se>
6 * Copyright (C) 2010 Canonical Ltd.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
26 *
27 ****************************************************************************/
28
29/* Tables are automatically generated by mtdev-mapgen */
30
31#ifndef _MTDEV_MAPPING_H
32#define _MTDEV_MAPPING_H
33
34#include <mtdev.h>
35
36#define MTDEV_TRACKING_ID 9
37#define MTDEV_POSITION_X 5
38#define MTDEV_POSITION_Y 6
39#define MTDEV_TOUCH_MAJOR 0
40#define MTDEV_TOUCH_MINOR 1
41#define MTDEV_WIDTH_MAJOR 2
42#define MTDEV_WIDTH_MINOR 3
43#define MTDEV_ORIENTATION 4
44
45static const unsigned int mtdev_map_abs2mt[ABS_CNT] = {
46 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
47 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
48 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
49 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
50 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
51 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
52 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
53 0x0009, 0x000a, 0x000b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
54};
55
56static const unsigned int mtdev_map_mt2abs[MT_ABS_SIZE] = {
57 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
58 0x0038, 0x0039, 0x003a,
59};
60
61static inline int mtdev_is_absmt(unsigned int code)
62{
63 return mtdev_map_abs2mt[code];
64}
65
66static inline unsigned int mtdev_abs2mt(unsigned int code)
67{
68 return mtdev_map_abs2mt[code] - 1;
69}
70
71static inline unsigned int mtdev_mt2abs(unsigned int mtcode)
72{
73 return mtdev_map_mt2abs[mtcode];
74}
75
76#endif