Re: [PATCH] HID: uclogic: Add support for XP-PEN Deco LW

From: Barnabás Pőcze
Date: Thu Oct 27 2022 - 17:32:44 EST


Hi


2022. október 27., csütörtök 23:10 keltezéssel, José Expósito írta:

> [...]
> +/**
> + * uclogic_params_ugee_v2_has_battery() - check whether a UGEE v2 device has
> + * battery or not.
> + * @hdev: The HID device of the tablet interface.
> + *
> + * Returns:
> + * True if the device has battery, false otherwise.
> + */
> +static bool uclogic_params_ugee_v2_has_battery(struct hid_device *hdev)
> +{
> + /* The XP-PEN Deco LW vendor, product and version are identical to the
> + * Deco L. The only difference reported by their firmware is the product
> + * name. Add a quirk to support battery reporting on the wireless
> + * version.
> + */
> + if (hdev->vendor == USB_VENDOR_ID_UGEE &&
> + hdev->product == USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) {
> + struct usb_device *udev = hid_to_usb_dev(hdev);
> + const char *lw_name = "Deco LW";
> +
> + if (strncmp(udev->product, lw_name, strlen(lw_name)) == 0)

Please use `strstarts()` here instead.


> + return true;
> + }
> +
> + return false;
> +}
> [...]


Regards,
Barnabás Pőcze