From d5b3178ca184dee4b3116e5b569745d43dbe37ef Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sun, 21 Mar 2010 14:57:42 +0100 Subject: Add support for the ABS_MT_PRESSURE event The kernel MT api was recently updated to include the ABS_MT_PRESSURE event. This patch adds it to the hardware structure. Signed-off-by: Henrik Rydberg --- src/common.h | 5 +++++ src/hwdata.c | 3 +++ src/hwdata.h | 2 +- src/state.c | 4 +++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common.h b/src/common.h index f64e114..27082b7 100644 --- a/src/common.h +++ b/src/common.h @@ -48,6 +48,11 @@ #define MT_TOOL_PEN 1 #endif +/* includes available in 2.6.33 */ +#ifndef ABS_MT_PRESSURE +#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ +#endif + #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) #define BITMASK(x) (1U << (x)) diff --git a/src/hwdata.c b/src/hwdata.c index bd42710..9e384dc 100644 --- a/src/hwdata.c +++ b/src/hwdata.c @@ -81,6 +81,9 @@ int read_hwdata(struct HWData *hw, const struct input_event* ev) case ABS_MT_ORIENTATION: hw->finger[hw->nread].orientation = ev->value; break; + case ABS_MT_PRESSURE: + hw->finger[hw->nread].pressure = ev->value; + break; case ABS_MT_POSITION_X: hw->finger[hw->nread].position_x = ev->value; break; diff --git a/src/hwdata.h b/src/hwdata.h index 9b46073..38ffc6b 100644 --- a/src/hwdata.h +++ b/src/hwdata.h @@ -37,7 +37,7 @@ struct FingerData { int touch_major, touch_minor; int width_major, width_minor; - int orientation; + int orientation, pressure; int position_x, position_y; }; diff --git a/src/state.c b/src/state.c index 895d096..774828a 100644 --- a/src/state.c +++ b/src/state.c @@ -150,13 +150,15 @@ void output_state(const struct State *s) s->nfinger); for (i = 0; i < s->nfinger; i++) { xf86Msg(X_INFO, - " %+02d %+05d:%+05d +%05d:%+05d %+06d %+05d:%+05d\n", + " %+02d %+05d:%+05d +%05d:%+05d " + "%+06d %+06d %+05d:%+05d\n", s->finger[i].id, s->finger[i].hw.touch_major, s->finger[i].hw.touch_minor, s->finger[i].hw.width_major, s->finger[i].hw.width_minor, s->finger[i].hw.orientation, + s->finger[i].hw.pressure, s->finger[i].hw.position_x, s->finger[i].hw.position_y); } -- cgit v1.2.3