aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2015-03-03 12:44:05 -0500
committerJiri Kosina <jkosina@suse.cz>2015-03-03 15:31:56 -0500
commitfce8c5fd82e8c3d39a919f649d8ddd97310f4b63 (patch)
treedda1d807b5c68bb9c329e8c2643db9a77af075d6 /drivers/hid
parentaa2121ac477845eb64d46278e93765b82a005c90 (diff)
HID: uclogic: actually invert the in-range bit for huion tablets only
This hack is only needed for Huion tablets. It does not seem to have any effect on the other tablets handled by this device right now, but it's better to check for the product id sooner than discovering that we have messed up one tablet later. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-uclogic.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
index f44e72bc1a0a..bdda9fd05c1f 100644
--- a/drivers/hid/hid-uclogic.c
+++ b/drivers/hid/hid-uclogic.c
@@ -564,6 +564,7 @@ enum uclogic_ph_id {
564 564
565/* Report descriptor template placeholder */ 565/* Report descriptor template placeholder */
566#define UCLOGIC_PH(_ID) UCLOGIC_PH_HEAD, UCLOGIC_PH_ID_##_ID 566#define UCLOGIC_PH(_ID) UCLOGIC_PH_HEAD, UCLOGIC_PH_ID_##_ID
567#define UCLOGIC_PEN_REPORT_ID 0x07
567 568
568/* Fixed report descriptor template */ 569/* Fixed report descriptor template */
569static const __u8 uclogic_tablet_rdesc_template[] = { 570static const __u8 uclogic_tablet_rdesc_template[] = {
@@ -625,6 +626,7 @@ enum uclogic_prm {
625struct uclogic_drvdata { 626struct uclogic_drvdata {
626 __u8 *rdesc; 627 __u8 *rdesc;
627 unsigned int rsize; 628 unsigned int rsize;
629 bool invert_pen_inrange;
628}; 630};
629 631
630static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, 632static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -905,6 +907,7 @@ static int uclogic_probe(struct hid_device *hdev,
905 hid_err(hdev, "tablet enabling failed\n"); 907 hid_err(hdev, "tablet enabling failed\n");
906 return rc; 908 return rc;
907 } 909 }
910 drvdata->invert_pen_inrange = true;
908 } 911 }
909 break; 912 break;
910 } 913 }
@@ -927,12 +930,12 @@ static int uclogic_probe(struct hid_device *hdev,
927static int uclogic_raw_event(struct hid_device *hdev, struct hid_report *report, 930static int uclogic_raw_event(struct hid_device *hdev, struct hid_report *report,
928 u8 *data, int size) 931 u8 *data, int size)
929{ 932{
930 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 933 struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
931 934
932 /* If this is a pen input report */ 935 if ((drvdata->invert_pen_inrange) &&
933 if (intf->cur_altsetting->desc.bInterfaceNumber == 0 && 936 (report->type == HID_INPUT_REPORT) &&
934 report->type == HID_INPUT_REPORT && 937 (report->id == UCLOGIC_PEN_REPORT_ID) &&
935 report->id == 0x07 && size >= 2) 938 (size >= 2))
936 /* Invert the in-range bit */ 939 /* Invert the in-range bit */
937 data[1] ^= 0x40; 940 data[1] ^= 0x40;
938 941