Skip to content

Commit

Permalink
Series-to: Fred Bloggs <f.blogs@napier.co.nz> Series-cc: Sean O'Brien…
Browse files Browse the repository at this point in the history
… <seobrien@chromium.org> HID: input: Restore missing cursor for digitizer devices

A previously committed patch to remove cursors for HID Digitizer-Pen
devices also removed the cursors for some tablets which have incorrect HID
descriptors. These devices should enumerate with Usage ID "Digitizer"
instead of Usage ID "Pen".

Patch which introduced the issue: commit 8473a93
("HID: input: Set INPUT_PROP_-property for HID_UP_DIGITIZERS")

Changes-
Add HID quirk HID_QUIRK_DEVICE_IS_DIGITIZER
Quirk will force INPUT_PROP_POINTER for HID Digitizers
Apply quirk to Huion tablets
Apply quirk to UGEE/XP-Pen tablets based on device ID

Signed-off-by: Torsha Banerjee <torsha@google.com>
  • Loading branch information
Jora Jacobi authored and intel-lab-lkp committed Mar 28, 2023
1 parent 197b6b6 commit 15e6cca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/hid/hid-input.c
Expand Up @@ -927,7 +927,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
break;

case HID_UP_DIGITIZER:
if ((field->application & 0xff) == 0x01) /* Digitizer */
if (((field->application & 0xff) == 0x01) ||
(device->quirks & HID_QUIRK_DEVICE_IS_DIGITIZER)) /* Digitizer */
__set_bit(INPUT_PROP_POINTER, input->propbit);
else if ((field->application & 0xff) == 0x02) /* Pen */
__set_bit(INPUT_PROP_DIRECT, input->propbit);
Expand Down
9 changes: 9 additions & 0 deletions drivers/hid/hid-quirks.c
Expand Up @@ -102,6 +102,8 @@ static const struct hid_device_id hid_quirks[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0941), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_1f4a), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_HS64), HID_QUIRK_DEVICE_IS_DIGITIZER },
{ HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET), HID_QUIRK_DEVICE_IS_DIGITIZER },
{ HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X), HID_QUIRK_MULTI_INPUT },
Expand Down Expand Up @@ -1298,6 +1300,13 @@ unsigned long hid_lookup_quirk(const struct hid_device *hdev)
quirks = hid_gets_squirk(hdev);
mutex_unlock(&dquirks_lock);

/*
* UGEE/XP-Pen HID Pen devices which have 0x0-0x9 as the low nibble
* of the device ID are actually digitizers, not HID Pen devices
*/
if (hdev->vendor == USB_VENDOR_ID_UGEE && (hdev->product & 0x0F) <= 0x09)
quirks |= HID_QUIRK_DEVICE_IS_DIGITIZER;

return quirks;
}
EXPORT_SYMBOL_GPL(hid_lookup_quirk);
2 changes: 2 additions & 0 deletions include/linux/hid.h
Expand Up @@ -352,8 +352,10 @@ struct hid_item {
/* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */
#define HID_QUIRK_ALWAYS_POLL BIT(10)
#define HID_QUIRK_INPUT_PER_APP BIT(11)

#define HID_QUIRK_X_INVERT BIT(12)
#define HID_QUIRK_Y_INVERT BIT(13)
#define HID_QUIRK_DEVICE_IS_DIGITIZER BIT(14)
#define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16)
#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17)
#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)
Expand Down

0 comments on commit 15e6cca

Please sign in to comment.