1 /*****************************************************************************
2 *
3 * mtdev - Multitouch Protocol Translation Library (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 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include <mtdev.h>
39
40 #ifndef MTDEV_NO_LEGACY_API
41
42 #define MTDEV_TOUCH_MAJOR 0
43 #define MTDEV_TOUCH_MINOR 1
44 #define MTDEV_WIDTH_MAJOR 2
45 #define MTDEV_WIDTH_MINOR 3
46 #define MTDEV_ORIENTATION 4
47 #define MTDEV_POSITION_X 5
48 #define MTDEV_POSITION_Y 6
49 #define MTDEV_TOOL_TYPE 7
50 #define MTDEV_BLOB_ID 8
51 #define MTDEV_TRACKING_ID 9
52 #define MTDEV_PRESSURE 10
53
54 static const unsigned int mtdev_map_abs2mt[ABS_CNT] = {
55 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
56 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
57 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
58 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
59 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
60 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
61 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
62 0x0009, 0x000a, 0x000b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
63 };
64
65 static const unsigned int mtdev_map_mt2abs[MT_ABS_SIZE] = {
66 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
67 0x0038, 0x0039, 0x003a,
68 };
69
mtdev_is_absmt(unsigned int code)70 static inline int mtdev_is_absmt(unsigned int code)
71 {
72 return mtdev_map_abs2mt[code];
73 }
74
mtdev_abs2mt(unsigned int code)75 static inline unsigned int mtdev_abs2mt(unsigned int code)
76 {
77 return mtdev_map_abs2mt[code] - 1;
78 }
79
mtdev_mt2abs(unsigned int mtcode)80 static inline unsigned int mtdev_mt2abs(unsigned int mtcode)
81 {
82 return mtdev_map_mt2abs[mtcode];
83 }
84
85 #endif
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif
92