diff mbox

[NEEDS,TEST] elantech: discard the first 2 positions reports for some firmwares

Message ID 4C02B18D.3050003@tudelft.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Éric Piel May 30, 2010, 6:42 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b18862b..1c1d065 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -185,7 +185,7 @@  static void elantech_report_absolute_v1(struct psmouse *psmouse)
 	struct elantech_data *etd = psmouse->private;
 	unsigned char *packet = psmouse->packet;
 	int fingers;
-	static int old_fingers;
+	static int one_finger_reports;
 
 	if (etd->fw_version < 0x020000) {
 		/*
@@ -203,11 +203,13 @@  static void elantech_report_absolute_v1(struct psmouse *psmouse)
 	}
 
 	if (etd->jumpy_cursor) {
-		/* Discard packets that are likely to have bogus coordinates */
-		if (fingers > old_fingers) {
+		if ((fingers == 1) && (one_finger_reports < 2)) {
+			/* Discard first 2 reports of one finger, bogus */
+			one_finger_reports++;
 			elantech_debug("discarding packet\n");
-			goto discard_packet_v1;
-		}
+			return;
+		} else if (fingers != 1)
+			one_finger_reports = 0;
 	}
 
 	input_report_key(dev, BTN_TOUCH, fingers != 0);
@@ -238,9 +240,6 @@  static void elantech_report_absolute_v1(struct psmouse *psmouse)
 	}
 
 	input_sync(dev);
-
- discard_packet_v1:
-	old_fingers = fingers;
 }
 
 /*
@@ -733,12 +732,12 @@  int elantech_init(struct psmouse *psmouse)
 	etd->capabilities = param[0];
 
 	/*
-	 * This firmware seems to suffer from misreporting coordinates when
+	 * This firmware suffers from misreporting coordinates when
 	 * a touch action starts causing the mouse cursor or scrolled page
 	 * to jump. Enable a workaround.
 	 */
-	if (etd->fw_version == 0x020022) {
-		pr_info("firmware version 2.0.34 detected, enabling jumpy cursor workaround\n");
+	if ((etd->fw_version == 0x020022) || (etd->fw_version == 0x020600)) {
+		pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n");
 		etd->jumpy_cursor = 1;
 	}