[PATCH 7/7] elantech: average the two coordinates when 2 fingers

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

 



When 2 fingers are pressed, the low and high coordinates are given.
Instead of reporting just the low coordinate as the normal position,
report an average of both. This allow to have the cursor always move,
whichever finger moves. In practice, this improves the support of
two-fingers scolling with the synaptics X driver.

Signed-off-by: Éric Piel <eric.piel@xxxxxxxxxxxxxxxx>
---
 drivers/input/mouse/elantech.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index c84f741..d1b505a 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -301,11 +301,11 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
 		/* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */
 		y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]);
 		/*
-		 * For compatibility with the X Synaptics driver scale up
-		 * one coordinate and report as ordinary mouse movent
+		 * For compatibility with non-multitouch userspace apps
+		 * report the average of both coordinates and scale up.
 		 */
-		input_report_abs(dev, ABS_X, x1 << 2);
-		input_report_abs(dev, ABS_Y, y1 << 2);
+		input_report_abs(dev, ABS_X, (x1 + x2) << 1);
+		input_report_abs(dev, ABS_Y, (y1 + y2) << 1);
 		/*
 		 * For compatibility with the proprietary X Elantech driver
 		 * report both coordinates as hat coordinates
-- 
1.7.1


--
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