Skip to content

Commit

Permalink
HID: uclogic: make input_mapping independent of usb
Browse files Browse the repository at this point in the history
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 <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Mar 16, 2015
1 parent bbb2d8a commit ee20fe2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions drivers/hid/hid-uclogic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -908,6 +905,8 @@ static int uclogic_probe(struct hid_device *hdev,
return rc;
}
drvdata->invert_pen_inrange = true;
} else {
drvdata->ignore_pen_usage = true;
}
break;
}
Expand Down

0 comments on commit ee20fe2

Please sign in to comment.