From 987a6c0298260b7aa40702b349282554d6180e4b Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Mon, 2 Aug 2010 20:15:17 -0700 Subject: Input: switch to input_abs_*() access functions Change all call sites in drivers/input to not access the ABS axis information directly anymore. Make them use the access helpers instead. Also use input_set_abs_params() when possible. Did some code refactoring as I was on it. Signed-off-by: Daniel Mack Cc: Dmitry Torokhov Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/pc110pad.c | 4 ++-- drivers/input/mouse/synaptics.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c index 3941f97cfa60..7b02b652e267 100644 --- a/drivers/input/mouse/pc110pad.c +++ b/drivers/input/mouse/pc110pad.c @@ -145,8 +145,8 @@ static int __init pc110pad_init(void) pc110pad_dev->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y); pc110pad_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); - pc110pad_dev->absmax[ABS_X] = 0x1ff; - pc110pad_dev->absmax[ABS_Y] = 0x0ff; + input_abs_set_max(pc110pad_dev, ABS_X, 0x1ff); + input_abs_set_max(pc110pad_dev, ABS_Y, 0x0ff); pc110pad_dev->open = pc110pad_open; pc110pad_dev->close = pc110pad_close; diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 85a1e1460996..2bf93432b8c0 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -629,8 +629,8 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) __clear_bit(REL_X, dev->relbit); __clear_bit(REL_Y, dev->relbit); - dev->absres[ABS_X] = priv->x_res; - dev->absres[ABS_Y] = priv->y_res; + input_abs_set_res(dev, ABS_X, priv->x_res); + input_abs_set_res(dev, ABS_Y, priv->y_res); if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { /* Clickpads report only left button */ -- cgit v1.2.3-59-g8ed1b From 7f29f17b57255b6395046805a98bc663ded63fb8 Mon Sep 17 00:00:00 2001 From: Éric Piel Date: Thu, 5 Aug 2010 23:51:49 -0700 Subject: Input: elantech - discard the first 2 positions on some firmwares MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/elantech.c | 21 ++++++++++----------- drivers/input/mouse/elantech.h | 7 ++++--- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index b18862b2a70e..bd5b91da169e 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) struct elantech_data *etd = psmouse->private; unsigned char *packet = psmouse->packet; int fingers; - static int old_fingers; if (etd->fw_version < 0x020000) { /* @@ -203,10 +202,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("discarding packet\n"); - goto discard_packet_v1; + return; } } @@ -238,9 +240,6 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) } input_sync(dev); - - discard_packet_v1: - old_fingers = fingers; } /* @@ -733,13 +732,13 @@ 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"); - etd->jumpy_cursor = 1; + 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 = true; } if (elantech_set_absolute_mode(psmouse)) { diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index ac57bde1bb9f..aa4aac5d2198 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -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]; }; -- cgit v1.2.3-59-g8ed1b From 22462d9fcf5b29184716aca486058943b2d6995f Mon Sep 17 00:00:00 2001 From: Éric Piel Date: Thu, 5 Aug 2010 23:51:49 -0700 Subject: Input: elantech - report position also with 3 fingers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 6-byte protocol supports reporting the position when three fingers are pressed, exactly like when one finger is pressed. Report this. In addition, it is also distinguishes between 3 and 4 fingers pressed. Signed-off-by: Éric Piel Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/elantech.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index bd5b91da169e..48311204ba51 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -257,6 +257,14 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) input_report_key(dev, BTN_TOUCH, fingers != 0); switch (fingers) { + case 3: + /* + * Same as one finger, except report of more than 3 fingers: + * byte 3: n4 . w1 w0 . . . . + */ + if (packet[3] & 0x80) + fingers = 4; + /* pass through... */ case 1: /* * byte 1: . . . . . x10 x9 x8 @@ -309,6 +317,7 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); + input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4); input_report_key(dev, BTN_LEFT, packet[0] & 0x01); input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); @@ -466,6 +475,7 @@ static void elantech_set_input_params(struct psmouse *psmouse) break; case 2: + __set_bit(BTN_TOOL_QUADTAP, dev->keybit); input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); -- cgit v1.2.3-59-g8ed1b