[PATCH 2/4] Use MT (in addition to single-touch) protocol for all events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Android (begining with Gingerbread) ignores all single-touch events
from multi-touch capable devices. This patch augments the pen and
single-touch handlers to emit MT events for Android's consumption.

Signed-off-by: Jason Gerecke <killertofu@xxxxxxxxx>
---
 Now being sent upstream to LKML at the behest of Google.

 drivers/input/touchscreen/wacom_w8001.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
index 7630806..e94a21a 100644
--- a/drivers/input/touchscreen/wacom_w8001.c
+++ b/drivers/input/touchscreen/wacom_w8001.c
@@ -278,6 +278,13 @@ static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)
 	input_report_key(dev, BTN_TOUCH, coord->tsw);
 	input_report_key(dev, BTN_STYLUS, coord->f1);
 	input_report_key(dev, w8001->type, coord->rdy);
+
+	input_report_abs(dev, ABS_MT_POSITION_X, coord->x);
+	input_report_abs(dev, ABS_MT_POSITION_Y, coord->y);
+	input_report_abs(dev, ABS_MT_PRESSURE, coord->pen_pressure);
+	input_report_abs(dev, ABS_MT_TOOL_TYPE, MT_TOOL_PEN);
+
+	input_mt_sync(dev);
 	input_sync(dev);
 
 	if (!coord->rdy)
@@ -298,6 +305,11 @@ static void report_single_touch(struct w8001 *w8001, struct w8001_coord *coord)
 	input_report_key(dev, BTN_TOUCH, coord->tsw);
 	input_report_key(dev, BTN_TOOL_FINGER, coord->tsw);
 
+	input_report_abs(dev, ABS_MT_POSITION_X, x);
+	input_report_abs(dev, ABS_MT_POSITION_Y, y);
+	input_report_abs(dev, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER);
+
+	input_mt_sync(dev);
 	input_sync(dev);
 
 	w8001->type = coord->tsw ? BTN_TOOL_FINGER : KEY_RESERVED;
@@ -485,6 +497,8 @@ static int w8001_setup(struct w8001 *w8001)
 						0, touch.y, 0, 0);
 			input_set_abs_params(dev, ABS_MT_TOOL_TYPE,
 						0, MT_TOOL_MAX, 0, 0);
+			input_set_abs_params(dev, ABS_MT_PRESSURE,
+						0, coord.pen_pressure, 0, 0);
 
 			strlcat(w8001->name, " 2FG", sizeof(w8001->name));
 			if (w8001->max_pen_x && w8001->max_pen_y)
-- 
1.7.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux