aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2018-09-04 09:31:12 -0400
committerJiri Kosina <jkosina@suse.cz>2018-09-04 15:31:21 -0400
commitec6adef5fbc3f140c70e7499fdad818acb3a46c6 (patch)
tree45a810e2eabdf87e9aaade33918e6790a99e3d85
parent43822c98f2ebb2cbd5e467ab72bbcdae7f0caa22 (diff)
HID: multitouch: fix Elan panels with 2 input modes declaration
When implementing commit 7f81c8db5489 ("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: 7f81c8db5489 ("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>
-rw-r--r--drivers/hid/hid-multitouch.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 40fbb7c52723..88da991ef256 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1375,7 +1375,8 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev,
1375 struct hid_usage *usage, 1375 struct hid_usage *usage,
1376 enum latency_mode latency, 1376 enum latency_mode latency,
1377 bool surface_switch, 1377 bool surface_switch,
1378 bool button_switch) 1378 bool button_switch,
1379 bool *inputmode_found)
1379{ 1380{
1380 struct mt_device *td = hid_get_drvdata(hdev); 1381 struct mt_device *td = hid_get_drvdata(hdev);
1381 struct mt_class *cls = &td->mtclass; 1382 struct mt_class *cls = &td->mtclass;
@@ -1387,6 +1388,14 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev,
1387 1388
1388 switch (usage->hid) { 1389 switch (usage->hid) {
1389 case HID_DG_INPUTMODE: 1390 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
1390 if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) { 1399 if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) {
1391 report_len = hid_report_len(report); 1400 report_len = hid_report_len(report);
1392 buf = hid_alloc_report_buf(report, GFP_KERNEL); 1401 buf = hid_alloc_report_buf(report, GFP_KERNEL);
@@ -1402,6 +1411,7 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev,
1402 } 1411 }
1403 1412
1404 field->value[index] = td->inputmode_value; 1413 field->value[index] = td->inputmode_value;
1414 *inputmode_found = true;
1405 return true; 1415 return true;
1406 1416
1407 case HID_DG_CONTACTMAX: 1417 case HID_DG_CONTACTMAX:
@@ -1439,6 +1449,7 @@ static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency,
1439 struct hid_usage *usage; 1449 struct hid_usage *usage;
1440 int i, j; 1450 int i, j;
1441 bool update_report; 1451 bool update_report;
1452 bool inputmode_found = false;
1442 1453
1443 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; 1454 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT];
1444 list_for_each_entry(rep, &rep_enum->report_list, list) { 1455 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,
1457 usage, 1468 usage,
1458 latency, 1469 latency,
1459 surface_switch, 1470 surface_switch,
1460 button_switch)) 1471 button_switch,
1472 &inputmode_found))
1461 update_report = true; 1473 update_report = true;
1462 } 1474 }
1463 } 1475 }