summaryrefslogtreecommitdiff
path: root/src/touch-dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/touch-dev.c')
-rw-r--r--src/touch-dev.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/touch-dev.c b/src/touch-dev.c
index 3c3036c..b327266 100644
--- a/src/touch-dev.c
+++ b/src/touch-dev.c
@@ -27,7 +27,22 @@
27#include <string.h> 27#include <string.h>
28#include <errno.h> 28#include <errno.h>
29#include "evbuf.h" 29#include "evbuf.h"
30#include "mtdev-details.h" 30
31/* from mtdev-mapping.h */
32#define MT_TOUCH_MAJOR 0
33#define MT_TOUCH_MINOR 1
34#define MT_WIDTH_MAJOR 2
35#define MT_WIDTH_MINOR 3
36#define MT_ORIENTATION 4
37#define MT_POSITION_X 5
38#define MT_POSITION_Y 6
39#define MT_TRACKING_ID 9
40#define MT_PRESSURE 10
41
42int mtdev_fetch_event(struct mtdev *dev, int fd, struct input_event *ev);
43void mtdev_put_event(struct mtdev *dev, const struct input_event *ev);
44int mtdev_empty(struct mtdev *dev);
45void mtdev_get_event(struct mtdev *dev, struct input_event* ev);
31 46
32struct touch_dev_impl { 47struct touch_dev_impl {
33 int id[DIM_TOUCH]; 48 int id[DIM_TOUCH];
@@ -49,22 +64,22 @@ static inline void set_info(struct touch_dev_caps *caps, int code,
49static void set_caps(struct touch_dev_caps *caps, 64static void set_caps(struct touch_dev_caps *caps,
50 const struct mtdev_caps *mtcaps) 65 const struct mtdev_caps *mtcaps)
51{ 66{
52 if (mtcaps->has_abs[MTDEV_POSITION_X]) 67 if (mtcaps->has_abs[MT_POSITION_X])
53 set_info(caps, TP_POS_X, &mtcaps->abs[MTDEV_POSITION_X]); 68 set_info(caps, TP_POS_X, &mtcaps->abs[MT_POSITION_X]);
54 if (mtcaps->has_abs[MTDEV_POSITION_Y]) 69 if (mtcaps->has_abs[MT_POSITION_Y])
55 set_info(caps, TP_POS_Y, &mtcaps->abs[MTDEV_POSITION_Y]); 70 set_info(caps, TP_POS_Y, &mtcaps->abs[MT_POSITION_Y]);
56 if (mtcaps->has_abs[MTDEV_TOUCH_MAJOR]) 71 if (mtcaps->has_abs[MT_TOUCH_MAJOR])
57 set_info(caps, TP_TOUCH_MAJOR, &mtcaps->abs[MTDEV_TOUCH_MAJOR]); 72 set_info(caps, TP_TOUCH_MAJOR, &mtcaps->abs[MT_TOUCH_MAJOR]);
58 if (mtcaps->has_abs[MTDEV_TOUCH_MINOR]) 73 if (mtcaps->has_abs[MT_TOUCH_MINOR])
59 set_info(caps, TP_TOUCH_MINOR, &mtcaps->abs[MTDEV_TOUCH_MINOR]); 74 set_info(caps, TP_TOUCH_MINOR, &mtcaps->abs[MT_TOUCH_MINOR]);
60 if (mtcaps->has_abs[MTDEV_WIDTH_MAJOR]) 75 if (mtcaps->has_abs[MT_WIDTH_MAJOR])
61 set_info(caps, TP_WIDTH_MAJOR, &mtcaps->abs[MTDEV_WIDTH_MAJOR]); 76 set_info(caps, TP_WIDTH_MAJOR, &mtcaps->abs[MT_WIDTH_MAJOR]);
62 if (mtcaps->has_abs[MTDEV_WIDTH_MINOR]) 77 if (mtcaps->has_abs[MT_WIDTH_MINOR])
63 set_info(caps, TP_WIDTH_MINOR, &mtcaps->abs[MTDEV_WIDTH_MINOR]); 78 set_info(caps, TP_WIDTH_MINOR, &mtcaps->abs[MT_WIDTH_MINOR]);
64 if (mtcaps->has_abs[MTDEV_ORIENTATION]) 79 if (mtcaps->has_abs[MT_ORIENTATION])
65 set_info(caps, TP_ORIENTATION, &mtcaps->abs[MTDEV_ORIENTATION]); 80 set_info(caps, TP_ORIENTATION, &mtcaps->abs[MT_ORIENTATION]);
66 if (mtcaps->has_abs[MTDEV_PRESSURE]) 81 if (mtcaps->has_abs[MT_PRESSURE])
67 set_info(caps, TP_PRESSURE, &mtcaps->abs[MTDEV_PRESSURE]); 82 set_info(caps, TP_PRESSURE, &mtcaps->abs[MT_PRESSURE]);
68} 83}
69 84
70static int touch_get_fetched(struct touch_dev_impl *x, 85static int touch_get_fetched(struct touch_dev_impl *x,