diff options
author | Éric Piel <E.A.B.Piel@tudelft.nl> | 2010-08-06 02:51:49 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-08-06 02:52:29 -0400 |
commit | 7f29f17b57255b6395046805a98bc663ded63fb8 (patch) | |
tree | 0ec8e1a2164f6e2c458d47ce631ff1fdc8ed5a75 | |
parent | 7be3c13425ddeed8427cfaad65c9123c2c8ca331 (diff) |
Input: elantech - discard the first 2 positions on some firmwares
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>
-rw-r--r-- | drivers/input/mouse/elantech.c | 21 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.h | 7 |
2 files changed, 14 insertions, 14 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index b18862b2a70..bd5b91da169 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -185,7 +185,6 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) | |||
185 | struct elantech_data *etd = psmouse->private; | 185 | struct elantech_data *etd = psmouse->private; |
186 | unsigned char *packet = psmouse->packet; | 186 | unsigned char *packet = psmouse->packet; |
187 | int fingers; | 187 | int fingers; |
188 | static int old_fingers; | ||
189 | 188 | ||
190 | if (etd->fw_version < 0x020000) { | 189 | if (etd->fw_version < 0x020000) { |
191 | /* | 190 | /* |
@@ -203,10 +202,13 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) | |||
203 | } | 202 | } |
204 | 203 | ||
205 | if (etd->jumpy_cursor) { | 204 | if (etd->jumpy_cursor) { |
206 | /* Discard packets that are likely to have bogus coordinates */ | 205 | if (fingers != 1) { |
207 | if (fingers > old_fingers) { | 206 | etd->single_finger_reports = 0; |
207 | } else if (etd->single_finger_reports < 2) { | ||
208 | /* Discard first 2 reports of one finger, bogus */ | ||
209 | etd->single_finger_reports++; | ||
208 | elantech_debug("discarding packet\n"); | 210 | elantech_debug("discarding packet\n"); |
209 | goto discard_packet_v1; | 211 | return; |
210 | } | 212 | } |
211 | } | 213 | } |
212 | 214 | ||
@@ -238,9 +240,6 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) | |||
238 | } | 240 | } |
239 | 241 | ||
240 | input_sync(dev); | 242 | input_sync(dev); |
241 | |||
242 | discard_packet_v1: | ||
243 | old_fingers = fingers; | ||
244 | } | 243 | } |
245 | 244 | ||
246 | /* | 245 | /* |
@@ -733,13 +732,13 @@ int elantech_init(struct psmouse *psmouse) | |||
733 | etd->capabilities = param[0]; | 732 | etd->capabilities = param[0]; |
734 | 733 | ||
735 | /* | 734 | /* |
736 | * This firmware seems to suffer from misreporting coordinates when | 735 | * This firmware suffers from misreporting coordinates when |
737 | * a touch action starts causing the mouse cursor or scrolled page | 736 | * a touch action starts causing the mouse cursor or scrolled page |
738 | * to jump. Enable a workaround. | 737 | * to jump. Enable a workaround. |
739 | */ | 738 | */ |
740 | if (etd->fw_version == 0x020022) { | 739 | if (etd->fw_version == 0x020022 || etd->fw_version == 0x020600) { |
741 | pr_info("firmware version 2.0.34 detected, enabling jumpy cursor workaround\n"); | 740 | pr_info("firmware version 2.0.34/2.6.0 detected, enabling jumpy cursor workaround\n"); |
742 | etd->jumpy_cursor = 1; | 741 | etd->jumpy_cursor = true; |
743 | } | 742 | } |
744 | 743 | ||
745 | if (elantech_set_absolute_mode(psmouse)) { | 744 | if (elantech_set_absolute_mode(psmouse)) { |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index ac57bde1bb9..aa4aac5d219 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -100,10 +100,11 @@ struct elantech_data { | |||
100 | unsigned char reg_26; | 100 | unsigned char reg_26; |
101 | unsigned char debug; | 101 | unsigned char debug; |
102 | unsigned char capabilities; | 102 | unsigned char capabilities; |
103 | unsigned char paritycheck; | 103 | bool paritycheck; |
104 | unsigned char jumpy_cursor; | 104 | bool jumpy_cursor; |
105 | unsigned char hw_version; | 105 | unsigned char hw_version; |
106 | unsigned int fw_version; | 106 | unsigned int fw_version; |
107 | unsigned int single_finger_reports; | ||
107 | unsigned char parity[256]; | 108 | unsigned char parity[256]; |
108 | }; | 109 | }; |
109 | 110 | ||