summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2009-05-16 20:07:01 +0200
committerHenrik Rydberg <rydberg@euromail.se>2009-05-16 20:07:01 +0200
commitba20f03d7d2794b3d794e839ba1db45ba327bb62 (patch)
tree35fdd3c1a3c9863c601750c81f24a56bca122b94 /src
parentecb6a617cc0af69fd4733d9095a5cff842b8e552 (diff)
adapt to final version of MT protocol
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src')
-rw-r--r--src/common.h33
-rw-r--r--src/hwdata.c33
-rw-r--r--src/hwdata.h3
3 files changed, 32 insertions, 37 deletions
diff --git a/src/common.h b/src/common.h
index 0ddfaaf..cbcde90 100644
--- a/src/common.h
+++ b/src/common.h
@@ -8,25 +8,28 @@
8#include <linux/input.h> 8#include <linux/input.h>
9#include <errno.h> 9#include <errno.h>
10#include <match/match.h> 10#include <match/match.h>
11//#include <exevents.h>
12 11
13//////////////////////////////////////////////////////// 12////////////////////////////////////////////////////////
14//#define BTN_MT_REPORT_PACKET 0x210 /* report multitouch packet data */ 13
15//#define BTN_MT_REPORT_FINGER 0x211 /* report multitouch finger data */ 14// includes available in 2.6.30-rc5
16#define BTN_TOOL_PRESS 0x148 /* The trackpad is a physical button */ 15
17#define BTN_MT_REPORT_PACKET 0x14b /* multitouch device */ 16#ifndef BTN_TOOL_QUADTAP
18#define BTN_MT_REPORT_FINGER 0x14c /* multitouch device */
19#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ 17#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
18#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
19#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
20#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
21#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
22#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
23#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
24#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
25#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
26#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
27#define SYN_MT_REPORT 2
28#define MT_TOOL_FINGER 0
29#define MT_TOOL_PEN 1
30#endif
20 31
21#define ABS_MT_TOUCH 0x30 32////////////////////////////////////////////////////////
22#define ABS_MT_TOUCH_MAJOR 0x30
23#define ABS_MT_TOUCH_MINOR 0x31
24#define ABS_MT_WIDTH 0x32
25#define ABS_MT_WIDTH_MAJOR 0x32
26#define ABS_MT_WIDTH_MINOR 0x33
27#define ABS_MT_ORIENTATION 0x34
28#define ABS_MT_POSITION_X 0x35
29#define ABS_MT_POSITION_Y 0x36
30 33
31#define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) 34#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
32 35
diff --git a/src/hwdata.c b/src/hwdata.c
index cd93fe0..aa4c271 100644
--- a/src/hwdata.c
+++ b/src/hwdata.c
@@ -15,7 +15,12 @@ bool read_hwdata(struct HWData *hw, const struct input_event* ev)
15 case EV_SYN: 15 case EV_SYN:
16 switch (ev->code) { 16 switch (ev->code) {
17 case SYN_REPORT: 17 case SYN_REPORT:
18 hw->nread = 0;
18 return 1; 19 return 1;
20 case SYN_MT_REPORT:
21 hw->nread++;
22 hw->nfinger = hw->nread;
23 break;
19 } 24 }
20 break; 25 break;
21 case EV_KEY: 26 case EV_KEY:
@@ -38,44 +43,32 @@ bool read_hwdata(struct HWData *hw, const struct input_event* ev)
38 else 43 else
39 CLEARBIT(hw->button, MT_BUTTON_RIGHT); 44 CLEARBIT(hw->button, MT_BUTTON_RIGHT);
40 break; 45 break;
41 case BTN_MT_REPORT_PACKET:
42 hw->in_packet = ev->value;
43 if (ev->value)
44 hw->nfinger = 0;
45 break;
46 case BTN_MT_REPORT_FINGER:
47 hw->in_finger = ev->value;
48 if (!ev->value && hw->nfinger < DIM_FINGER)
49 hw->nfinger++;
50 break;
51 } 46 }
52 break; 47 break;
53 case EV_ABS: 48 case EV_ABS:
54 if (!hw->in_packet || !hw->in_finger) 49 if (hw->nread == DIM_FINGER)
55 break;
56 if (hw->nfinger == DIM_FINGER)
57 break; 50 break;
58 switch (ev->code) { 51 switch (ev->code) {
59 case ABS_MT_TOUCH_MAJOR: 52 case ABS_MT_TOUCH_MAJOR:
60 hw->finger[hw->nfinger].touch_major = ev->value; 53 hw->finger[hw->nread].touch_major = ev->value;
61 break; 54 break;
62 case ABS_MT_TOUCH_MINOR: 55 case ABS_MT_TOUCH_MINOR:
63 hw->finger[hw->nfinger].touch_minor = ev->value; 56 hw->finger[hw->nread].touch_minor = ev->value;
64 break; 57 break;
65 case ABS_MT_WIDTH_MAJOR: 58 case ABS_MT_WIDTH_MAJOR:
66 hw->finger[hw->nfinger].width_major = ev->value; 59 hw->finger[hw->nread].width_major = ev->value;
67 break; 60 break;
68 case ABS_MT_WIDTH_MINOR: 61 case ABS_MT_WIDTH_MINOR:
69 hw->finger[hw->nfinger].width_minor = ev->value; 62 hw->finger[hw->nread].width_minor = ev->value;
70 break; 63 break;
71 case ABS_MT_ORIENTATION: 64 case ABS_MT_ORIENTATION:
72 hw->finger[hw->nfinger].orientation = ev->value; 65 hw->finger[hw->nread].orientation = ev->value;
73 break; 66 break;
74 case ABS_MT_POSITION_X: 67 case ABS_MT_POSITION_X:
75 hw->finger[hw->nfinger].position_x = ev->value; 68 hw->finger[hw->nread].position_x = ev->value;
76 break; 69 break;
77 case ABS_MT_POSITION_Y: 70 case ABS_MT_POSITION_Y:
78 hw->finger[hw->nfinger].position_y = ev->value; 71 hw->finger[hw->nread].position_y = ev->value;
79 break; 72 break;
80 } 73 }
81 break; 74 break;
diff --git a/src/hwdata.h b/src/hwdata.h
index a5f9bf5..a4ecd87 100644
--- a/src/hwdata.h
+++ b/src/hwdata.h
@@ -25,8 +25,7 @@ struct FingerData {
25struct HWData { 25struct HWData {
26 struct FingerData finger[DIM_FINGER]; 26 struct FingerData finger[DIM_FINGER];
27 button_t button; 27 button_t button;
28 int nfinger; 28 int nfinger, nread;
29 bool in_packet, in_finger;
30}; 29};
31 30
32//////////////////////////////////////////////////////// 31////////////////////////////////////////////////////////