aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-12-16 10:09:25 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-18 11:47:29 -0500
commitc15bdfd5b9831e4cab8cfc118243956e267dd30e (patch)
tree0b239e0ae12ab4189a83a6f7c71feb5c814484b3 /drivers/input
parent768d9aa55740754aa4efb8aca594e3841237dd88 (diff)
Input: elantech - improve clickpad detection
The current assumption in the elantech driver that hw version 3 touchpads are never clickpads and hw version 4 touchpads are always clickpads is wrong. There are several bug reports for this, ie: https://bugzilla.redhat.com/show_bug.cgi?id=1030802 http://superuser.com/questions/619582/right-elantech-touchpad-button-not-working-in-linux I've spend a couple of hours wading through various bugzillas, launchpads and forum posts to create a list of fw-versions and capabilities for different laptop models to find a good method to differentiate between clickpads and versions with separate hardware buttons. Which shows that a device being a clickpad is reliable indicated by bit 12 being set in the fw_version. I've included the gathered list inside the driver, so that we've this info at hand if we need to revisit this later. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/elantech.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 597e9b8fc18d..ef1cf52f8bb9 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -486,6 +486,7 @@ static void elantech_input_sync_v4(struct psmouse *psmouse)
486 unsigned char *packet = psmouse->packet; 486 unsigned char *packet = psmouse->packet;
487 487
488 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 488 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
489 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
489 input_mt_report_pointer_emulation(dev, true); 490 input_mt_report_pointer_emulation(dev, true);
490 input_sync(dev); 491 input_sync(dev);
491} 492}
@@ -984,6 +985,44 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
984} 985}
985 986
986/* 987/*
988 * Advertise INPUT_PROP_BUTTONPAD for clickpads. The testing of bit 12 in
989 * fw_version for this is based on the following fw_version & caps table:
990 *
991 * Laptop-model: fw_version: caps: buttons:
992 * Acer S3 0x461f00 10, 13, 0e clickpad
993 * Acer S7-392 0x581f01 50, 17, 0d clickpad
994 * Acer V5-131 0x461f02 01, 16, 0c clickpad
995 * Acer V5-551 0x461f00 ? clickpad
996 * Asus K53SV 0x450f01 78, 15, 0c 2 hw buttons
997 * Asus G46VW 0x460f02 00, 18, 0c 2 hw buttons
998 * Asus G750JX 0x360f00 00, 16, 0c 2 hw buttons
999 * Asus UX31 0x361f00 20, 15, 0e clickpad
1000 * Asus UX32VD 0x361f02 00, 15, 0e clickpad
1001 * Avatar AVIU-145A2 0x361f00 ? clickpad
1002 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
1003 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)
1004 * Samsung NF210 0x150b00 78, 14, 0a 2 hw buttons
1005 * Samsung NP770Z5E 0x575f01 10, 15, 0f clickpad
1006 * Samsung NP700Z5B 0x361f06 21, 15, 0f clickpad
1007 * Samsung NP900X3E-A02 0x575f03 ? clickpad
1008 * Samsung NP-QX410 0x851b00 19, 14, 0c clickpad
1009 * Samsung RC512 0x450f00 08, 15, 0c 2 hw buttons
1010 * Samsung RF710 0x450f00 ? 2 hw buttons
1011 * System76 Pangolin 0x250f01 ? 2 hw buttons
1012 * (*) + 3 trackpoint buttons
1013 */
1014static void elantech_set_buttonpad_prop(struct psmouse *psmouse)
1015{
1016 struct input_dev *dev = psmouse->dev;
1017 struct elantech_data *etd = psmouse->private;
1018
1019 if (etd->fw_version & 0x001000) {
1020 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
1021 __clear_bit(BTN_RIGHT, dev->keybit);
1022 }
1023}
1024
1025/*
987 * Set the appropriate event bits for the input subsystem 1026 * Set the appropriate event bits for the input subsystem
988 */ 1027 */
989static int elantech_set_input_params(struct psmouse *psmouse) 1028static int elantech_set_input_params(struct psmouse *psmouse)
@@ -1026,6 +1065,8 @@ static int elantech_set_input_params(struct psmouse *psmouse)
1026 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); 1065 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
1027 /* fall through */ 1066 /* fall through */
1028 case 3: 1067 case 3:
1068 if (etd->hw_version == 3)
1069 elantech_set_buttonpad_prop(psmouse);
1029 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); 1070 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
1030 input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); 1071 input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
1031 if (etd->reports_pressure) { 1072 if (etd->reports_pressure) {
@@ -1047,9 +1088,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
1047 */ 1088 */
1048 psmouse_warn(psmouse, "couldn't query resolution data.\n"); 1089 psmouse_warn(psmouse, "couldn't query resolution data.\n");
1049 } 1090 }
1050 /* v4 is clickpad, with only one button. */ 1091 elantech_set_buttonpad_prop(psmouse);
1051 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
1052 __clear_bit(BTN_RIGHT, dev->keybit);
1053 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); 1092 __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
1054 /* For X to recognize me as touchpad. */ 1093 /* For X to recognize me as touchpad. */
1055 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); 1094 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);