Re: [PATCH v3] HID: kye: Add support for MousePen M508X
From: Yangfl
Date: Tue Nov 22 2022 - 06:56:11 EST
Jiri Kosina <jikos@xxxxxxxxxx> 于2022年11月22日周二 17:29写道:
>
> 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?
>
Reorder to match the sequence of device ids in hid-ids.h. Same below.
> > 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?
>
USB_DEVICE_ID_KYE_PENSKETCH_M912 is moved upward, see -756,6 +888,10.
> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
>