]> git.itanic.dy.fi Git - linux-stable/commitdiff
Input: elantech - discard the first 2 positions on some firmwares
authorÉric Piel <E.A.B.Piel@tudelft.nl>
Fri, 6 Aug 2010 06:51:49 +0000 (23:51 -0700)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 14 Mar 2012 14:57:33 +0000 (10:57 -0400)
commit 7f29f17b57255b6395046805a98bc663ded63fb8 upstream.

According to the Dell/Ubuntu driver, what was previously observed as
"jumpy cursor" corresponds to the hardware sending incorrect data for
the first two reports of a one touch finger. So let's use the same
workaround as in the other driver. Also, detect another firmware
version with the same behaviour, as in the other driver.

Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/input/mouse/elantech.c
drivers/input/mouse/elantech.h

index 440036944b6687c2a80fd17f7fbda7173b74999d..a0c19c2e9818027f1c0eb8ce8158122a3c587680 100644 (file)
@@ -183,7 +183,6 @@ 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;
 
        if (etd->fw_version < 0x020000) {
                /*
@@ -201,10 +200,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) {
+                       etd->single_finger_reports = 0;
+               } else if (etd->single_finger_reports < 2) {
+                       /* Discard first 2 reports of one finger, bogus */
+                       etd->single_finger_reports++;
                        elantech_debug("elantech.c: discarding packet\n");
-                       goto discard_packet_v1;
+                       return;
                }
        }
 
@@ -236,9 +238,6 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
        }
 
        input_sync(dev);
-
- discard_packet_v1:
-       old_fingers = fingers;
 }
 
 /*
@@ -734,14 +733,14 @@ 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("elantech.c: firmware version 2.0.34 detected, "
+       if (etd->fw_version == 0x020022 || etd->fw_version == 0x020600) {
+               pr_info("elantech.c: firmware version 2.0.34/2.6.0 detected, "
                        "enabling jumpy cursor workaround\n");
-               etd->jumpy_cursor = 1;
+               etd->jumpy_cursor = true;
        }
 
        if (elantech_set_absolute_mode(psmouse)) {
index ac57bde1bb9f3e62fb3b891227521f0b63df3946..aa4aac5d21983988e8e8de6c3d150d579dba0ae0 100644 (file)
@@ -100,10 +100,11 @@ struct elantech_data {
        unsigned char reg_26;
        unsigned char debug;
        unsigned char capabilities;
-       unsigned char paritycheck;
-       unsigned char jumpy_cursor;
+       bool paritycheck;
+       bool jumpy_cursor;
        unsigned char hw_version;
-       unsigned int  fw_version;
+       unsigned int fw_version;
+       unsigned int single_finger_reports;
        unsigned char parity[256];
 };