From ba20f03d7d2794b3d794e839ba1db45ba327bb62 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 16 May 2009 20:07:01 +0200 Subject: adapt to final version of MT protocol Signed-off-by: Henrik Rydberg --- src/common.h | 33 ++++++++++++++++++--------------- src/hwdata.c | 33 +++++++++++++-------------------- src/hwdata.h | 3 +-- 3 files changed, 32 insertions(+), 37 deletions(-) (limited to 'src') 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 @@ #include #include #include -//#include //////////////////////////////////////////////////////// -//#define BTN_MT_REPORT_PACKET 0x210 /* report multitouch packet data */ -//#define BTN_MT_REPORT_FINGER 0x211 /* report multitouch finger data */ -#define BTN_TOOL_PRESS 0x148 /* The trackpad is a physical button */ -#define BTN_MT_REPORT_PACKET 0x14b /* multitouch device */ -#define BTN_MT_REPORT_FINGER 0x14c /* multitouch device */ + +// includes available in 2.6.30-rc5 + +#ifndef BTN_TOOL_QUADTAP #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ +#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ +#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ +#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ +#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ +#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ +#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ +#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ +#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ +#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ +#define SYN_MT_REPORT 2 +#define MT_TOOL_FINGER 0 +#define MT_TOOL_PEN 1 +#endif -#define ABS_MT_TOUCH 0x30 -#define ABS_MT_TOUCH_MAJOR 0x30 -#define ABS_MT_TOUCH_MINOR 0x31 -#define ABS_MT_WIDTH 0x32 -#define ABS_MT_WIDTH_MAJOR 0x32 -#define ABS_MT_WIDTH_MINOR 0x33 -#define ABS_MT_ORIENTATION 0x34 -#define ABS_MT_POSITION_X 0x35 -#define ABS_MT_POSITION_Y 0x36 +//////////////////////////////////////////////////////// #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) 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) case EV_SYN: switch (ev->code) { case SYN_REPORT: + hw->nread = 0; return 1; + case SYN_MT_REPORT: + hw->nread++; + hw->nfinger = hw->nread; + break; } break; case EV_KEY: @@ -38,44 +43,32 @@ bool read_hwdata(struct HWData *hw, const struct input_event* ev) else CLEARBIT(hw->button, MT_BUTTON_RIGHT); break; - case BTN_MT_REPORT_PACKET: - hw->in_packet = ev->value; - if (ev->value) - hw->nfinger = 0; - break; - case BTN_MT_REPORT_FINGER: - hw->in_finger = ev->value; - if (!ev->value && hw->nfinger < DIM_FINGER) - hw->nfinger++; - break; } break; case EV_ABS: - if (!hw->in_packet || !hw->in_finger) - break; - if (hw->nfinger == DIM_FINGER) + if (hw->nread == DIM_FINGER) break; switch (ev->code) { case ABS_MT_TOUCH_MAJOR: - hw->finger[hw->nfinger].touch_major = ev->value; + hw->finger[hw->nread].touch_major = ev->value; break; case ABS_MT_TOUCH_MINOR: - hw->finger[hw->nfinger].touch_minor = ev->value; + hw->finger[hw->nread].touch_minor = ev->value; break; case ABS_MT_WIDTH_MAJOR: - hw->finger[hw->nfinger].width_major = ev->value; + hw->finger[hw->nread].width_major = ev->value; break; case ABS_MT_WIDTH_MINOR: - hw->finger[hw->nfinger].width_minor = ev->value; + hw->finger[hw->nread].width_minor = ev->value; break; case ABS_MT_ORIENTATION: - hw->finger[hw->nfinger].orientation = ev->value; + hw->finger[hw->nread].orientation = ev->value; break; case ABS_MT_POSITION_X: - hw->finger[hw->nfinger].position_x = ev->value; + hw->finger[hw->nread].position_x = ev->value; break; case ABS_MT_POSITION_Y: - hw->finger[hw->nfinger].position_y = ev->value; + hw->finger[hw->nread].position_y = ev->value; break; } 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 { struct HWData { struct FingerData finger[DIM_FINGER]; button_t button; - int nfinger; - bool in_packet, in_finger; + int nfinger, nread; }; //////////////////////////////////////////////////////// -- cgit v1.2.3