2020-03-03 21:52:48

by Tony Fischetti

[permalink] [raw]
Subject: Trouble adding QUIRK_ALWAYS_POLL to quirky USB mouse

Hi all,

I have a lenovo pixart mouse (vendorId: 0x17ef, productId: 0x608d)
that's afflicted with the apparently common problem of disconnecting
and re-connecting every minute, each time incrementing the device
number

I tried to apply a patch very much like the one in this commit with
the identical problem: dcf768b0ac868630e7bdb6f2f1c9fe72788012fa
The particular patch I applied appears at the end of this email (not
meant to be submitted/applied, just as a reference)

The problem is that when I apply the patch and boot the new kernel,
the quirk appears not to have been registered (it doesn't appear in
/sys/module/usbhid/parameters/quirks)
It is only when I add the kernel boot parameter
usbhid.quirks=0x17ef:0x608d:0x00000400 that it appears to be working

Anyone have any ideas on how to fix this? I'd like to submit a patch
fixing this issue once I get it sorted out

Thank you for your time.

---
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-quirks.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3a400ce603c4..9e1dfc714ea8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -726,6 +726,7 @@
#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
#define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_OPTICAL_MOUSE 0x608d

#define USB_VENDOR_ID_LG 0x1fd2
#define USB_DEVICE_ID_LG_MULTITOUCH 0x0064
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 0e7b2d998395..247747d6d8cf 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -103,6 +103,7 @@ static const struct hid_device_id hid_quirks[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_KYE_PENSKETCH_M912), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL },
+ { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO,
USB_DEVICE_ID_LENOVO_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL
},
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET },
--


2020-03-04 15:08:18

by Alan Stern

[permalink] [raw]
Subject: Re: Trouble adding QUIRK_ALWAYS_POLL to quirky USB mouse

On Tue, 3 Mar 2020, Tony Fischetti wrote:

> Hi all,
>
> I have a lenovo pixart mouse (vendorId: 0x17ef, productId: 0x608d)
> that's afflicted with the apparently common problem of disconnecting
> and re-connecting every minute, each time incrementing the device
> number
>
> I tried to apply a patch very much like the one in this commit with
> the identical problem: dcf768b0ac868630e7bdb6f2f1c9fe72788012fa
> The particular patch I applied appears at the end of this email (not
> meant to be submitted/applied, just as a reference)
>
> The problem is that when I apply the patch and boot the new kernel,
> the quirk appears not to have been registered (it doesn't appear in
> /sys/module/usbhid/parameters/quirks)
> It is only when I add the kernel boot parameter
> usbhid.quirks=0x17ef:0x608d:0x00000400 that it appears to be working
>
> Anyone have any ideas on how to fix this? I'd like to submit a patch
> fixing this issue once I get it sorted out

If you have usbhid loaded as a module instead of built into the kernel,
then it probably is getting loaded from the initramfs. If you didn't
rebuild the initramfs image after creating the new kernel, you would
end up loading the original module without the new quirk entry.

It's easy enough to test this. After booting, do:

rmmod usbhid ; modprobe usbhid

and see if the quirk entry then shows up in sysfs.

Alan Stern