Re: [PATCH v3] HID: kye: Add support for MousePen M508X
From: Jiri Kosina
Date: Tue Nov 22 2022 - 04:29:43 EST
On Sun, 20 Nov 2022, David Yang wrote:
> Genius MousePen M508X digitizer tablet sends incorrect report descriptor by
> default. This patch replaces it with a corrected one.
>
> Signed-off-by: David Yang <mmyangfl@xxxxxxxxx>
Thanks for the fix. A few comments below.
> @@ -626,18 +751,24 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> *rsize = sizeof(easypen_m610x_rdesc_fixed);
> }
> break;
> - case USB_DEVICE_ID_KYE_EASYPEN_M406XE:
> - if (*rsize == EASYPEN_M406XE_RDESC_ORIG_SIZE) {
> - rdesc = easypen_m406xe_rdesc_fixed;
> - *rsize = sizeof(easypen_m406xe_rdesc_fixed);
> - }
> - break;
> case USB_DEVICE_ID_KYE_PENSKETCH_M912:
> if (*rsize == PENSKETCH_M912_RDESC_ORIG_SIZE) {
> rdesc = pensketch_m912_rdesc_fixed;
> *rsize = sizeof(pensketch_m912_rdesc_fixed);
> }
> break;
> + case USB_DEVICE_ID_KYE_MOUSEPEN_M508X:
> + if (*rsize == MOUSEPEN_M508X_RDESC_ORIG_SIZE) {
> + rdesc = mousepen_m508x_rdesc_fixed;
> + *rsize = sizeof(mousepen_m508x_rdesc_fixed);
> + }
> + break;
> + case USB_DEVICE_ID_KYE_EASYPEN_M406XE:
> + if (*rsize == EASYPEN_M406XE_RDESC_ORIG_SIZE) {
> + rdesc = easypen_m406xe_rdesc_fixed;
> + *rsize = sizeof(easypen_m406xe_rdesc_fixed);
> + }
> + break;
What is the reason for moving USB_DEVICE_ID_KYE_EASYPEN_M406XE around?
> case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE:
> rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104,
> "Genius Gila Gaming Mouse");
> @@ -721,8 +852,9 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id)
> case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
> case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2:
> case USB_DEVICE_ID_KYE_EASYPEN_M610X:
> - case USB_DEVICE_ID_KYE_EASYPEN_M406XE:
> case USB_DEVICE_ID_KYE_PENSKETCH_M912:
> + case USB_DEVICE_ID_KYE_MOUSEPEN_M508X:
> + case USB_DEVICE_ID_KYE_EASYPEN_M406XE:
Same here.
> ret = kye_tablet_enable(hdev);
> if (ret) {
> hid_err(hdev, "tablet enabling failed\n");
> @@ -756,6 +888,10 @@ static const struct hid_device_id kye_devices[] = {
> USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2) },
> { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> USB_DEVICE_ID_KYE_EASYPEN_M610X) },
> + { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> + USB_DEVICE_ID_KYE_PENSKETCH_M912) },
> + { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> + USB_DEVICE_ID_KYE_MOUSEPEN_M508X) },
> { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> USB_DEVICE_ID_KYE_EASYPEN_M406XE) },
> { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> @@ -764,8 +900,6 @@ static const struct hid_device_id kye_devices[] = {
> USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
> { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> USB_DEVICE_ID_GENIUS_MANTICORE) },
> - { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> - USB_DEVICE_ID_KYE_PENSKETCH_M912) },
This looks unrelated and incorrect, why are you dropping
USB_DEVICE_ID_KYE_PENSKETCH_M912 from the device table?
Thanks,
--
Jiri Kosina
SUSE Labs