diff mbox series

HID: holtek-mouse: start hardware in probe

Message ID 875yrgf05r.fsf@turner.link (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show
Series HID: holtek-mouse: start hardware in probe | expand

Commit Message

Jim Turner Dec. 22, 2021, 2:21 a.m. UTC
The holtek_mouse_probe() function is missing the necessary code to
start the hardware. When an Etekcity Scroll X1 (M555) USB mouse is
plugged in, the mouse receives power and the kernel recognizes it as a
USB device, but the system does not respond to any movement, clicking,
or scrolling of the mouse. Presumably, this bug also affects all other
mice supported by the hid-holtek-mouse driver, although this has not
been tested. On the stable linux-5.15.y branch, testing confirms that
the bug was introduced in commit a579510a64ed ("HID: check for valid
USB device for many HID drivers"), which was first included in
v5.15.8. Based on the source code, this bug appears to be present in
all currently-supported kernels (mainline, stable, and all LTS
kernels). Testing on hardware confirms that this proposed patch fixes
the bug for kernel v5.15.10. Fix holtek_mouse_probe() to call the
necessary functions to start the hardware.

Fixes: 93020953d0fa ("HID: check for valid USB device for many HID drivers")
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: James D. Turner <linuxkernel.foss@dmarc-none.turner.link>
---
This is my first time submitting a kernel patch. I think I've followed
all the directions, but please let me know if I should do something
differently.

In addition to testing this patch for the stable v5.15.10 kernel on real
hardware, I also tested it for the latest master of the hid repository
(commit 03090cc76ee3 ("Merge branch 'for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid")) using a VM with
USB passthrough.

 drivers/hid/hid-holtek-mouse.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


base-commit: 03090cc76ee3298cc70bce26bbe93a0cb50e42a2

Comments

Greg Kroah-Hartman Dec. 23, 2021, 7:04 a.m. UTC | #1
On Tue, Dec 21, 2021 at 09:21:41PM -0500, James D. Turner wrote:
> The holtek_mouse_probe() function is missing the necessary code to
> start the hardware. When an Etekcity Scroll X1 (M555) USB mouse is
> plugged in, the mouse receives power and the kernel recognizes it as a
> USB device, but the system does not respond to any movement, clicking,
> or scrolling of the mouse. Presumably, this bug also affects all other
> mice supported by the hid-holtek-mouse driver, although this has not
> been tested. On the stable linux-5.15.y branch, testing confirms that
> the bug was introduced in commit a579510a64ed ("HID: check for valid
> USB device for many HID drivers"), which was first included in
> v5.15.8. Based on the source code, this bug appears to be present in
> all currently-supported kernels (mainline, stable, and all LTS
> kernels). Testing on hardware confirms that this proposed patch fixes
> the bug for kernel v5.15.10. Fix holtek_mouse_probe() to call the
> necessary functions to start the hardware.
> 
> Fixes: 93020953d0fa ("HID: check for valid USB device for many HID drivers")
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: linux-input@vger.kernel.org
> Cc: stable@vger.kernel.org
> Signed-off-by: James D. Turner <linuxkernel.foss@dmarc-none.turner.link>
> ---
> This is my first time submitting a kernel patch. I think I've followed
> all the directions, but please let me know if I should do something
> differently.
> 
> In addition to testing this patch for the stable v5.15.10 kernel on real
> hardware, I also tested it for the latest master of the hid repository
> (commit 03090cc76ee3 ("Merge branch 'for-linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid")) using a VM with
> USB passthrough.

Thanks for the patch, but isn't this the same as commit 93a2207c254c
("HID: holtek: fix mouse probing") in Linus's tree right now?

thanks,

greg k-h
Jim Turner Dec. 23, 2021, 10:26 a.m. UTC | #2
> Thanks for the patch, but isn't this the same as commit 93a2207c254c
> ("HID: holtek: fix mouse probing") in Linus's tree right now?

Oh, I missed that. Yes, that commit is equivalent to this patch. I'm
sorry for the duplication. Please disregard this patch.
diff mbox series

Patch

diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
index b7172c48ef..29e41c97ec 100644
--- a/drivers/hid/hid-holtek-mouse.c
+++ b/drivers/hid/hid-holtek-mouse.c
@@ -65,9 +65,16 @@  static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 static int holtek_mouse_probe(struct hid_device *hdev,
 			      const struct hid_device_id *id)
 {
+	int ret;
+
 	if (!hid_is_usb(hdev))
 		return -EINVAL;
-	return 0;
+
+	ret = hid_parse(hdev);
+	if (!ret)
+		ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+	return ret;
 }
 
 static const struct hid_device_id holtek_mouse_devices[] = {