summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-12-22 18:35:53 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-12-22 18:35:53 +0100
commitcff212dbe28487c14ab040829877d77378a61344 (patch)
treed629334e7f45c0d5333411616bc653d66f92ced1
parent56a77e68fb91eef928d8a95c50ae14508e37ae0f (diff)
Add support for ABS_MT_DISTANCE
In the upcoming 2.6.38 kernel, support for hovering is introduced. Add the ABS_MT_DISTANCE to the extended set of handled ABS_MT events. The change is binary compatible with existing libraries. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--include/mtdev.h5
-rw-r--r--src/common.h6
-rw-r--r--test/mtdev-mapgen.c3
3 files changed, 10 insertions, 4 deletions
diff --git a/include/mtdev.h b/include/mtdev.h
index df74e95..ba682c5 100644
--- a/include/mtdev.h
+++ b/include/mtdev.h
@@ -63,6 +63,11 @@ extern "C" {
63#define ABS_MT_SLOT 0x2f /* MT slot being modified */ 63#define ABS_MT_SLOT 0x2f /* MT slot being modified */
64#endif 64#endif
65 65
66/* includes available in 2.6.38 */
67#ifndef ABS_MT_DISTANCE
68#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
69#endif
70
66#define MT_ID_NULL (-1) 71#define MT_ID_NULL (-1)
67#define MT_ID_MIN 0 72#define MT_ID_MIN 0
68#define MT_ID_MAX 65535 73#define MT_ID_MAX 65535
diff --git a/src/common.h b/src/common.h
index 43b5688..2ec8eb8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -111,7 +111,7 @@ struct mtdev {
111 struct mtdev_state *state; 111 struct mtdev_state *state;
112}; 112};
113 113
114#define MT_ABS_SIZE 11 114#define MT_ABS_SIZE 12
115 115
116static const unsigned int mtdev_map_abs2mt[ABS_CNT] = { 116static const unsigned int mtdev_map_abs2mt[ABS_CNT] = {
117 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 117 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -121,12 +121,12 @@ static const unsigned int mtdev_map_abs2mt[ABS_CNT] = {
121 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 121 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
122 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 122 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
123 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 123 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
124 0x0009, 0x000a, 0x000b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 124 0x0009, 0x000a, 0x000b, 0x000c, 0x0000, 0x0000, 0x0000, 0x0000,
125}; 125};
126 126
127static const unsigned int mtdev_map_mt2abs[MT_ABS_SIZE] = { 127static const unsigned int mtdev_map_mt2abs[MT_ABS_SIZE] = {
128 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 128 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
129 0x0038, 0x0039, 0x003a, 129 0x0038, 0x0039, 0x003a, 0x003b,
130}; 130};
131 131
132static inline int mtdev_is_absmt(unsigned int code) 132static inline int mtdev_is_absmt(unsigned int code)
diff --git a/test/mtdev-mapgen.c b/test/mtdev-mapgen.c
index dc1ba91..c34cb7e 100644
--- a/test/mtdev-mapgen.c
+++ b/test/mtdev-mapgen.c
@@ -30,7 +30,7 @@
30#include <mtdev.h> 30#include <mtdev.h>
31#include <stdio.h> 31#include <stdio.h>
32 32
33#define MT_ABS_SIZE 11 33#define MT_ABS_SIZE 12
34#define MT_SLOT_ABS_EVENTS { \ 34#define MT_SLOT_ABS_EVENTS { \
35 ABS_MT_TOUCH_MAJOR, \ 35 ABS_MT_TOUCH_MAJOR, \
36 ABS_MT_TOUCH_MINOR, \ 36 ABS_MT_TOUCH_MINOR, \
@@ -43,6 +43,7 @@
43 ABS_MT_BLOB_ID, \ 43 ABS_MT_BLOB_ID, \
44 ABS_MT_TRACKING_ID, \ 44 ABS_MT_TRACKING_ID, \
45 ABS_MT_PRESSURE, \ 45 ABS_MT_PRESSURE, \
46 ABS_MT_DISTANCE, \
46} 47}
47 48
48static unsigned int cabs2mt[ABS_CNT]; 49static unsigned int cabs2mt[ABS_CNT];