OSDN Git Service

upg
[joborun/jobcore.git] / linux-lts / reference-material / 0002-HID-holtek-fix-mouse-probing.patch
1 From b2d8dd6455350d10e35533fe209e7c11170f8deb Mon Sep 17 00:00:00 2001
2 From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
3 Date: Mon, 20 Dec 2021 10:51:20 +0100
4 Subject: [PATCH] HID: holtek: fix mouse probing
5
6 An overlook from the previous commit: we don't even parse or start the
7 device, meaning that the device is not presented to user space.
8
9 Fixes: 93020953d0fa ("HID: check for valid USB device for many HID drivers")
10 Cc: stable@vger.kernel.org
11 Link: https://bugs.archlinux.org/task/73048
12 Link: https://bugzilla.kernel.org/show_bug.cgi?id=215341
13 Link: https://lore.kernel.org/r/e4efbf13-bd8d-0370-629b-6c80c0044b15@leemhuis.info/
14 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
15 For: https://bugs.archlinux.org/task/73048
16 ---
17  drivers/hid/hid-holtek-mouse.c | 15 +++++++++++++++
18  1 file changed, 15 insertions(+)
19
20 diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
21 index b7172c48ef9f08..7c907939bfae1d 100644
22 --- a/drivers/hid/hid-holtek-mouse.c
23 +++ b/drivers/hid/hid-holtek-mouse.c
24 @@ -65,8 +65,23 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
25  static int holtek_mouse_probe(struct hid_device *hdev,
26                               const struct hid_device_id *id)
27  {
28 +       int ret;
29 +
30         if (!hid_is_usb(hdev))
31                 return -EINVAL;
32 +
33 +       ret = hid_parse(hdev);
34 +       if (ret) {
35 +               hid_err(hdev, "hid parse failed: %d\n", ret);
36 +               return ret;
37 +       }
38 +
39 +       ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
40 +       if (ret) {
41 +               hid_err(hdev, "hw start failed: %d\n", ret);
42 +               return ret;
43 +       }
44 +
45         return 0;
46  }
47