Commit ee20fe23 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

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: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent bbb2d8a8
...@@ -627,6 +627,7 @@ struct uclogic_drvdata { ...@@ -627,6 +627,7 @@ struct uclogic_drvdata {
__u8 *rdesc; __u8 *rdesc;
unsigned int rsize; unsigned int rsize;
bool invert_pen_inrange; bool invert_pen_inrange;
bool ignore_pen_usage;
}; };
static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, 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, ...@@ -719,16 +720,12 @@ static int uclogic_input_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage, struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max) unsigned long **bit, int *max)
{ {
struct usb_interface *intf; struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
if (hdev->product == USB_DEVICE_ID_HUION_TABLET) {
intf = to_usb_interface(hdev->dev.parent);
/* discard the unused pen interface */ /* discard the unused pen interface */
if ((intf->cur_altsetting->desc.bInterfaceNumber != 0) && if ((drvdata->ignore_pen_usage) &&
(field->application == HID_DG_PEN)) (field->application == HID_DG_PEN))
return -1; return -1;
}
/* let hid-core decide what to do */ /* let hid-core decide what to do */
return 0; return 0;
...@@ -908,6 +905,8 @@ static int uclogic_probe(struct hid_device *hdev, ...@@ -908,6 +905,8 @@ static int uclogic_probe(struct hid_device *hdev,
return rc; return rc;
} }
drvdata->invert_pen_inrange = true; drvdata->invert_pen_inrange = true;
} else {
drvdata->ignore_pen_usage = true;
} }
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment