[DIGImend-devel] [PATCH v2 1/2] uclogic: make input_mapping independent of usb
Brought to you by:
spb_nick
|
From: Benjamin T. <ben...@re...> - 2015-03-15 18:34:29
|
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. Sent upstream as: https://patchwork.kernel.org/patch/6013671/ --- changes in v2: - renamed ignore_pen_interface into ignore_pen_usage - updated commit message hid-uclogic.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hid-uclogic.c b/hid-uclogic.c index 51333fa..4b4a190 100644 --- a/hid-uclogic.c +++ b/hid-uclogic.c @@ -627,6 +627,7 @@ struct uclogic_drvdata { __u8 *rdesc; unsigned int rsize; bool invert_pen_inrange; + bool ignore_pen_usage; }; 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, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { - struct usb_interface *intf; - - if (hdev->product == USB_DEVICE_ID_HUION_TABLET) { - intf = to_usb_interface(hdev->dev.parent); + struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); - /* discard the unused pen interface */ - if ((intf->cur_altsetting->desc.bInterfaceNumber != 0) && - (field->application == HID_DG_PEN)) - return -1; - } + /* discard the unused pen interface */ + if ((drvdata->ignore_pen_usage) && + (field->application == HID_DG_PEN)) + return -1; /* let hid-core decide what to do */ return 0; @@ -910,6 +907,8 @@ static int uclogic_probe(struct hid_device *hdev, return rc; } drvdata->invert_pen_inrange = true; + } else { + drvdata->ignore_pen_usage = true; } break; case USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60: -- 2.3.1 |