aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2018-09-04 09:31:14 -0400
committerJiri Kosina <jkosina@suse.cz>2018-09-04 15:31:43 -0400
commit0d6c3011409135ea84e2a231b013a22017ff999a (patch)
treed15a6125044b26af915fca021375d61c3035086e
parentec6adef5fbc3f140c70e7499fdad818acb3a46c6 (diff)
HID: core: fix grouping by application
commit f07b3c1da92d ("HID: generic: create one input report per application type") was effectively the same as MULTI_INPUT: hidinput->report was never set, so hidinput_match_application() always returned null. Fix that by testing against the real application. Note that this breaks some old eGalax touchscreens that expect MULTI_INPUT instead of HID_QUIRK_INPUT_PER_APP. Enable this quirk for backward compatibility on all non-Win8 touchscreens. link: https://bugzilla.kernel.org/show_bug.cgi?id=200847 link: https://bugzilla.kernel.org/show_bug.cgi?id=200849 link: https://bugs.archlinux.org/task/59699 link: https://github.com/NixOS/nixpkgs/issues/45165 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-input.c4
-rw-r--r--drivers/hid/hid-multitouch.c3
-rw-r--r--include/linux/hid.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index ac201817a2dd..a481eaf39e88 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1582,6 +1582,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid,
1582 input_dev->dev.parent = &hid->dev; 1582 input_dev->dev.parent = &hid->dev;
1583 1583
1584 hidinput->input = input_dev; 1584 hidinput->input = input_dev;
1585 hidinput->application = application;
1585 list_add_tail(&hidinput->list, &hid->inputs); 1586 list_add_tail(&hidinput->list, &hid->inputs);
1586 1587
1587 INIT_LIST_HEAD(&hidinput->reports); 1588 INIT_LIST_HEAD(&hidinput->reports);
@@ -1677,8 +1678,7 @@ static struct hid_input *hidinput_match_application(struct hid_report *report)
1677 struct hid_input *hidinput; 1678 struct hid_input *hidinput;
1678 1679
1679 list_for_each_entry(hidinput, &hid->inputs, list) { 1680 list_for_each_entry(hidinput, &hid->inputs, list) {
1680 if (hidinput->report && 1681 if (hidinput->application == report->application)
1681 hidinput->report->application == report->application)
1682 return hidinput; 1682 return hidinput;
1683 } 1683 }
1684 1684
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 88da991ef256..da954f3f4da7 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1697,6 +1697,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
1697 */ 1697 */
1698 hdev->quirks |= HID_QUIRK_INPUT_PER_APP; 1698 hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
1699 1699
1700 if (id->group != HID_GROUP_MULTITOUCH_WIN_8)
1701 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
1702
1700 timer_setup(&td->release_timer, mt_expired_timeout, 0); 1703 timer_setup(&td->release_timer, mt_expired_timeout, 0);
1701 1704
1702 ret = hid_parse(hdev); 1705 ret = hid_parse(hdev);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 834e6461a690..d44a78362942 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -526,6 +526,7 @@ struct hid_input {
526 const char *name; 526 const char *name;
527 bool registered; 527 bool registered;
528 struct list_head reports; /* the list of reports */ 528 struct list_head reports; /* the list of reports */
529 unsigned int application; /* application usage for this input */
529}; 530};
530 531
531enum hid_type { 532enum hid_type {