diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/mouse/elantech.c | 28 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.h | 11 |
2 files changed, 13 insertions, 26 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index da161dae3502..cd8e2e5ced86 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -273,11 +273,11 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
273 | struct elantech_data *etd = psmouse->private; | 273 | struct elantech_data *etd = psmouse->private; |
274 | struct input_dev *dev = psmouse->dev; | 274 | struct input_dev *dev = psmouse->dev; |
275 | unsigned char *packet = psmouse->packet; | 275 | unsigned char *packet = psmouse->packet; |
276 | unsigned int fingers, x1 = 0, y1 = 0, x2 = 0, y2 = 0, width = 0, pres = 0; | 276 | unsigned int fingers, x1 = 0, y1 = 0, x2 = 0, y2 = 0; |
277 | unsigned int width = 0, pres = 0; | ||
277 | 278 | ||
278 | /* byte 0: n1 n0 . . . . R L */ | 279 | /* byte 0: n1 n0 . . . . R L */ |
279 | fingers = (packet[0] & 0xc0) >> 6; | 280 | fingers = (packet[0] & 0xc0) >> 6; |
280 | input_report_key(dev, BTN_TOUCH, fingers != 0); | ||
281 | 281 | ||
282 | switch (fingers) { | 282 | switch (fingers) { |
283 | case 3: | 283 | case 3: |
@@ -300,9 +300,6 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
300 | */ | 300 | */ |
301 | y1 = ETP_YMAX_V2 - (((packet[4] & 0x0f) << 8) | packet[5]); | 301 | y1 = ETP_YMAX_V2 - (((packet[4] & 0x0f) << 8) | packet[5]); |
302 | 302 | ||
303 | input_report_abs(dev, ABS_X, x1); | ||
304 | input_report_abs(dev, ABS_Y, y1); | ||
305 | |||
306 | pres = (packet[1] & 0xf0) | ((packet[4] & 0xf0) >> 4); | 303 | pres = (packet[1] & 0xf0) | ((packet[4] & 0xf0) >> 4); |
307 | width = ((packet[0] & 0x30) >> 2) | ((packet[3] & 0x30) >> 4); | 304 | width = ((packet[0] & 0x30) >> 2) | ((packet[3] & 0x30) >> 4); |
308 | break; | 305 | break; |
@@ -314,22 +311,18 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
314 | * byte 0: . . ay8 ax8 . . . . | 311 | * byte 0: . . ay8 ax8 . . . . |
315 | * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 | 312 | * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 |
316 | */ | 313 | */ |
317 | x1 = ((packet[0] & 0x10) << 4) | packet[1]; | 314 | x1 = (((packet[0] & 0x10) << 4) | packet[1]) << 2; |
318 | /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ | 315 | /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ |
319 | y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); | 316 | y1 = ETP_YMAX_V2 - |
317 | ((((packet[0] & 0x20) << 3) | packet[2]) << 2); | ||
320 | /* | 318 | /* |
321 | * byte 3: . . by8 bx8 . . . . | 319 | * byte 3: . . by8 bx8 . . . . |
322 | * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 | 320 | * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 |
323 | */ | 321 | */ |
324 | x2 = ((packet[3] & 0x10) << 4) | packet[4]; | 322 | x2 = (((packet[3] & 0x10) << 4) | packet[4]) << 2; |
325 | /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ | 323 | /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ |
326 | y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); | 324 | y2 = ETP_YMAX_V2 - |
327 | /* | 325 | ((((packet[3] & 0x20) << 3) | packet[5]) << 2); |
328 | * For compatibility with the X Synaptics driver scale up | ||
329 | * one coordinate and report as ordinary mouse movent | ||
330 | */ | ||
331 | input_report_abs(dev, ABS_X, x1 << 2); | ||
332 | input_report_abs(dev, ABS_Y, y1 << 2); | ||
333 | 326 | ||
334 | /* Unknown so just report sensible values */ | 327 | /* Unknown so just report sensible values */ |
335 | pres = 127; | 328 | pres = 127; |
@@ -337,6 +330,11 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
337 | break; | 330 | break; |
338 | } | 331 | } |
339 | 332 | ||
333 | input_report_key(dev, BTN_TOUCH, fingers != 0); | ||
334 | if (fingers != 0) { | ||
335 | input_report_abs(dev, ABS_X, x1); | ||
336 | input_report_abs(dev, ABS_Y, y1); | ||
337 | } | ||
340 | elantech_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); | 338 | elantech_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); |
341 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); | 339 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); |
342 | input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); | 340 | input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index fabb2b99615c..1c5894efda5a 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -82,17 +82,6 @@ | |||
82 | #define ETP_WMIN_V2 0 | 82 | #define ETP_WMIN_V2 0 |
83 | #define ETP_WMAX_V2 15 | 83 | #define ETP_WMAX_V2 15 |
84 | 84 | ||
85 | /* | ||
86 | * For two finger touches the coordinate of each finger gets reported | ||
87 | * separately but with reduced resolution. | ||
88 | */ | ||
89 | #define ETP_2FT_FUZZ 4 | ||
90 | |||
91 | #define ETP_2FT_XMIN ( 0 + ETP_2FT_FUZZ) | ||
92 | #define ETP_2FT_XMAX (288 - ETP_2FT_FUZZ) | ||
93 | #define ETP_2FT_YMIN ( 0 + ETP_2FT_FUZZ) | ||
94 | #define ETP_2FT_YMAX (192 - ETP_2FT_FUZZ) | ||
95 | |||
96 | struct elantech_data { | 85 | struct elantech_data { |
97 | unsigned char reg_10; | 86 | unsigned char reg_10; |
98 | unsigned char reg_11; | 87 | unsigned char reg_11; |