Skip to content

Commit cd9e83e

Browse files
jwrdegoededtor
authored andcommitted
Input: elantech - deal with clickpads reporting right button events
At least the Dell Vostro 5470 elantech *clickpad* reports right button clicks when clicked in the right bottom area: https://bugzilla.redhat.com/show_bug.cgi?id=1103528 This is different from how (elantech) clickpads normally operate, normally no matter where the user clicks on the pad the pad always reports a left button event, since there is only 1 hardware button beneath the path. It looks like Dell has put 2 buttons under the pad, one under each bottom corner, causing this. Since this however still clearly is a real clickpad hardware-wise, we still want to report it as such to userspace, so that things like finger movement in the bottom area can be properly ignored as it should be on clickpads. So deal with this weirdness by simply mapping a right click to a left click on elantech clickpads. As an added advantage this is something which we can simply do on all elantech clickpads, so no need to add special quirks for this weird model. Reported-and-tested-by: Elder Marco <eldermarco@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent cc071ac commit cd9e83e

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

drivers/input/mouse/elantech.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,15 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
473473
input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
474474
input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
475475
input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
476-
input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
477-
input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
476+
477+
/* For clickpads map both buttons to BTN_LEFT */
478+
if (etd->fw_version & 0x001000) {
479+
input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
480+
} else {
481+
input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
482+
input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
483+
}
484+
478485
input_report_abs(dev, ABS_PRESSURE, pres);
479486
input_report_abs(dev, ABS_TOOL_WIDTH, width);
480487

@@ -484,10 +491,17 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
484491
static void elantech_input_sync_v4(struct psmouse *psmouse)
485492
{
486493
struct input_dev *dev = psmouse->dev;
494+
struct elantech_data *etd = psmouse->private;
487495
unsigned char *packet = psmouse->packet;
488496

489-
input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
490-
input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
497+
/* For clickpads map both buttons to BTN_LEFT */
498+
if (etd->fw_version & 0x001000) {
499+
input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
500+
} else {
501+
input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
502+
input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
503+
}
504+
491505
input_mt_report_pointer_emulation(dev, true);
492506
input_sync(dev);
493507
}

0 commit comments

Comments
 (0)