Skip to content

Commit ec6adef

Browse files
bentissJiri Kosina
authored andcommitted
HID: multitouch: fix Elan panels with 2 input modes declaration
When implementing commit 7f81c8d ("HID: multitouch: simplify the settings of the various features"), I wrongly removed a test that made sure we never try to set the second InputMode feature to something else than 0. This broke badly some recent Elan panels that now forget to send the click button in some area of the touchpad. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200899 Fixes: 7f81c8d ("HID: multitouch: simplify the settings of the various features") Cc: stable@vger.kernel.org # v4.18+ Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 43822c9 commit ec6adef

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,8 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev,
13751375
struct hid_usage *usage,
13761376
enum latency_mode latency,
13771377
bool surface_switch,
1378-
bool button_switch)
1378+
bool button_switch,
1379+
bool *inputmode_found)
13791380
{
13801381
struct mt_device *td = hid_get_drvdata(hdev);
13811382
struct mt_class *cls = &td->mtclass;
@@ -1387,6 +1388,14 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev,
13871388

13881389
switch (usage->hid) {
13891390
case HID_DG_INPUTMODE:
1391+
/*
1392+
* Some elan panels wrongly declare 2 input mode features,
1393+
* and silently ignore when we set the value in the second
1394+
* field. Skip the second feature and hope for the best.
1395+
*/
1396+
if (*inputmode_found)
1397+
return false;
1398+
13901399
if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) {
13911400
report_len = hid_report_len(report);
13921401
buf = hid_alloc_report_buf(report, GFP_KERNEL);
@@ -1402,6 +1411,7 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev,
14021411
}
14031412

14041413
field->value[index] = td->inputmode_value;
1414+
*inputmode_found = true;
14051415
return true;
14061416

14071417
case HID_DG_CONTACTMAX:
@@ -1439,6 +1449,7 @@ static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency,
14391449
struct hid_usage *usage;
14401450
int i, j;
14411451
bool update_report;
1452+
bool inputmode_found = false;
14421453

14431454
rep_enum = &hdev->report_enum[HID_FEATURE_REPORT];
14441455
list_for_each_entry(rep, &rep_enum->report_list, list) {
@@ -1457,7 +1468,8 @@ static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency,
14571468
usage,
14581469
latency,
14591470
surface_switch,
1460-
button_switch))
1471+
button_switch,
1472+
&inputmode_found))
14611473
update_report = true;
14621474
}
14631475
}

0 commit comments

Comments
 (0)