aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorÉric Piel <E.A.B.Piel@tudelft.nl>2011-05-17 01:45:54 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-05-17 01:48:36 -0400
commitf941c705f68fa62f694678bf2efde64dfb9962bb (patch)
treea28ab3fe92f561df2e2998261dc20436be60b08a /drivers
parent71c6d18859ccb137343017ec995b76d9f62bd9b0 (diff)
Input: elantech - export pressure and width when supported
Using the info of the Dell/Ubuntu driver, described in the protocol document, report both width and pressure when pressing 1 and 3 fingers, for the versions of the touchpad which support it. Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net> Reviewed-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mouse/elantech.c23
-rw-r--r--drivers/input/mouse/elantech.h6
2 files changed, 28 insertions, 1 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 04d9bf320a4f..5cde11f4ef5e 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -248,9 +248,10 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
248 */ 248 */
249static void elantech_report_absolute_v2(struct psmouse *psmouse) 249static void elantech_report_absolute_v2(struct psmouse *psmouse)
250{ 250{
251 struct elantech_data *etd = psmouse->private;
251 struct input_dev *dev = psmouse->dev; 252 struct input_dev *dev = psmouse->dev;
252 unsigned char *packet = psmouse->packet; 253 unsigned char *packet = psmouse->packet;
253 int fingers, x1, y1, x2, y2; 254 int fingers, x1, y1, x2, y2, width = 0, pres = 0;
254 255
255 /* byte 0: n1 n0 . . . . R L */ 256 /* byte 0: n1 n0 . . . . R L */
256 fingers = (packet[0] & 0xc0) >> 6; 257 fingers = (packet[0] & 0xc0) >> 6;
@@ -278,6 +279,8 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
278 */ 279 */
279 input_report_abs(dev, ABS_Y, 280 input_report_abs(dev, ABS_Y,
280 ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5])); 281 ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5]));
282 pres = (packet[1] & 0xf0) | ((packet[4] & 0xf0) >> 4);
283 width = ((packet[0] & 0x30) >> 2) | ((packet[3] & 0x30) >> 4);
281 break; 284 break;
282 285
283 case 2: 286 case 2:
@@ -311,6 +314,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
311 input_report_abs(dev, ABS_HAT0Y, y1); 314 input_report_abs(dev, ABS_HAT0Y, y1);
312 input_report_abs(dev, ABS_HAT1X, x2); 315 input_report_abs(dev, ABS_HAT1X, x2);
313 input_report_abs(dev, ABS_HAT1Y, y2); 316 input_report_abs(dev, ABS_HAT1Y, y2);
317
318 /* Unknown so just report sensible values */
319 pres = 127;
320 width = 7;
314 break; 321 break;
315 } 322 }
316 323
@@ -320,6 +327,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
320 input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4); 327 input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4);
321 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 328 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
322 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); 329 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
330 if (etd->reports_pressure) {
331 input_report_abs(dev, ABS_PRESSURE, pres);
332 input_report_abs(dev, ABS_TOOL_WIDTH, width);
333 }
323 334
324 input_sync(dev); 335 input_sync(dev);
325} 336}
@@ -478,6 +489,12 @@ static void elantech_set_input_params(struct psmouse *psmouse)
478 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); 489 __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
479 input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); 490 input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0);
480 input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); 491 input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0);
492 if (etd->reports_pressure) {
493 input_set_abs_params(dev, ABS_PRESSURE, ETP_PMIN_V2,
494 ETP_PMAX_V2, 0, 0);
495 input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
496 ETP_WMAX_V2, 0, 0);
497 }
481 input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); 498 input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0);
482 input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); 499 input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0);
483 input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); 500 input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0);
@@ -725,6 +742,10 @@ int elantech_init(struct psmouse *psmouse)
725 etd->debug = 1; 742 etd->debug = 1;
726 /* Don't know how to do parity checking for version 2 */ 743 /* Don't know how to do parity checking for version 2 */
727 etd->paritycheck = 0; 744 etd->paritycheck = 0;
745
746 if (etd->fw_version >= 0x020800)
747 etd->reports_pressure = true;
748
728 } else { 749 } else {
729 etd->hw_version = 1; 750 etd->hw_version = 1;
730 etd->paritycheck = 1; 751 etd->paritycheck = 1;
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index aa4aac5d2198..fabb2b99615c 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -77,6 +77,11 @@
77#define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2) 77#define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2)
78#define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2) 78#define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2)
79 79
80#define ETP_PMIN_V2 0
81#define ETP_PMAX_V2 255
82#define ETP_WMIN_V2 0
83#define ETP_WMAX_V2 15
84
80/* 85/*
81 * For two finger touches the coordinate of each finger gets reported 86 * For two finger touches the coordinate of each finger gets reported
82 * separately but with reduced resolution. 87 * separately but with reduced resolution.
@@ -102,6 +107,7 @@ struct elantech_data {
102 unsigned char capabilities; 107 unsigned char capabilities;
103 bool paritycheck; 108 bool paritycheck;
104 bool jumpy_cursor; 109 bool jumpy_cursor;
110 bool reports_pressure;
105 unsigned char hw_version; 111 unsigned char hw_version;
106 unsigned int fw_version; 112 unsigned int fw_version;
107 unsigned int single_finger_reports; 113 unsigned int single_finger_reports;