Skip to content

Commit ee20fe2

Browse files
bentissJiri Kosina
authored andcommitted
HID: uclogic: make input_mapping independent of usb
No need to retrieve the USB handle in input_mapping() when we already do that in probe. It also allows to use the quirk without having to add the product ID matching. Signed-off-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent bbb2d8a commit ee20fe2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/hid/hid-uclogic.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ struct uclogic_drvdata {
627627
__u8 *rdesc;
628628
unsigned int rsize;
629629
bool invert_pen_inrange;
630+
bool ignore_pen_usage;
630631
};
631632

632633
static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -719,16 +720,12 @@ static int uclogic_input_mapping(struct hid_device *hdev, struct hid_input *hi,
719720
struct hid_field *field, struct hid_usage *usage,
720721
unsigned long **bit, int *max)
721722
{
722-
struct usb_interface *intf;
723-
724-
if (hdev->product == USB_DEVICE_ID_HUION_TABLET) {
725-
intf = to_usb_interface(hdev->dev.parent);
723+
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
726724

727-
/* discard the unused pen interface */
728-
if ((intf->cur_altsetting->desc.bInterfaceNumber != 0) &&
729-
(field->application == HID_DG_PEN))
730-
return -1;
731-
}
725+
/* discard the unused pen interface */
726+
if ((drvdata->ignore_pen_usage) &&
727+
(field->application == HID_DG_PEN))
728+
return -1;
732729

733730
/* let hid-core decide what to do */
734731
return 0;
@@ -908,6 +905,8 @@ static int uclogic_probe(struct hid_device *hdev,
908905
return rc;
909906
}
910907
drvdata->invert_pen_inrange = true;
908+
} else {
909+
drvdata->ignore_pen_usage = true;
911910
}
912911
break;
913912
}

0 commit comments

Comments
 (0)