Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: elantech - detect middle button based on firmware version

Looks like the new generation of Lenovo machine also need to
be added to the PnPID whitelist. This is definitively not going
to scale, as there is nothing that tells us currently if a
touchpad supports a true physical middle button.

Consider that all new touchpads that are not clickpads
(so matching ETP_NEW_IC_SMBUS_HOST_NOTIFY) are handling 3 physical
buttons.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Benjamin Tissoires and committed by
Dmitry Torokhov
fd1cf11f 88463497

+7 -12
+6 -12
drivers/input/mouse/elantech.c
··· 1107 1107 { } 1108 1108 }; 1109 1109 1110 - static const char * const middle_button_pnp_ids[] = { 1111 - "LEN2131", /* ThinkPad P52 w/ NFC */ 1112 - "LEN2132", /* ThinkPad P52 */ 1113 - "LEN2133", /* ThinkPad P72 w/ NFC */ 1114 - "LEN2134", /* ThinkPad P72 */ 1115 - "LEN0407", 1116 - "LEN0408", 1117 - NULL 1118 - }; 1119 - 1120 1110 /* 1121 1111 * Set the appropriate event bits for the input subsystem 1122 1112 */ ··· 1125 1135 __clear_bit(EV_REL, dev->evbit); 1126 1136 1127 1137 __set_bit(BTN_LEFT, dev->keybit); 1128 - if (dmi_check_system(elantech_dmi_has_middle_button) || 1129 - psmouse_matches_pnp_id(psmouse, middle_button_pnp_ids)) 1138 + if (info->has_middle_button) 1130 1139 __set_bit(BTN_MIDDLE, dev->keybit); 1131 1140 __set_bit(BTN_RIGHT, dev->keybit); 1132 1141 ··· 1738 1749 info->width = info->x_max / (traces - 1); 1739 1750 break; 1740 1751 } 1752 + 1753 + /* check for the middle button: DMI matching or new v4 firmwares */ 1754 + info->has_middle_button = dmi_check_system(elantech_dmi_has_middle_button) || 1755 + (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) && 1756 + !elantech_is_buttonpad(info)); 1741 1757 1742 1758 return 0; 1743 1759 }
+1
drivers/input/mouse/elantech.h
··· 158 158 bool crc_enabled; 159 159 bool set_hw_resolution; 160 160 bool has_trackpoint; 161 + bool has_middle_button; 161 162 int (*send_cmd)(struct psmouse *psmouse, unsigned char c, 162 163 unsigned char *param); 163 164 };