lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1426261322-7451-1-git-send-email-benjamin.tissoires@redhat.com>
Date:	Fri, 13 Mar 2015 11:42:02 -0400
From:	Benjamin Tissoires <benjamin.tissoires@...hat.com>
To:	Nikolai Kondrashov <spbnick@...il.com>,
	Jiri Kosina <jkosina@...e.cz>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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 <benjamin.tissoires@...hat.com>
---

Nick,

no need to cc DIGImend-devel when replying on this one, I'll send the same
to DIGImend-devel as soon as I have a patchwork link.

Cheers,
Benjamin

 drivers/hid/hid-uclogic.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
index bdda9fd..6473e83 100644
--- a/drivers/hid/hid-uclogic.c
+++ b/drivers/hid/hid-uclogic.c
@@ -627,6 +627,7 @@ struct uclogic_drvdata {
 	__u8 *rdesc;
 	unsigned int rsize;
 	bool invert_pen_inrange;
+	bool ignore_pen_interface;
 };
 
 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_interface) &&
+	    (field->application == HID_DG_PEN))
+		return -1;
 
 	/* let hid-core decide what to do */
 	return 0;
@@ -908,6 +905,8 @@ static int uclogic_probe(struct hid_device *hdev,
 				return rc;
 			}
 			drvdata->invert_pen_inrange = true;
+		} else {
+			drvdata->ignore_pen_interface = true;
 		}
 		break;
 	}
-- 
2.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ