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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1424213653-5970-3-git-send-email-benjamin.tissoires@redhat.com>
Date:	Tue, 17 Feb 2015 17:54:13 -0500
From:	Benjamin Tissoires <benjamin.tissoires@...hat.com>
To:	Nikolai Kondrashov <spbnick@...il.com>,
	Jiri Kosina <jkosina@...e.cz>
Cc:	Peter Hutterer <peter.hutterer@...-t.net>,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] HID: huion: split the stylus and pad in 2 nodes

Libinput expects the pad node to be different from the stylus one.
We can just use HID_QUIRK_MULTI_INPUT to separate the buttons of the
pad than the actual stylus.
We can also remove the unused interfaces.
Last, we append "Pen" or "Pad" suffix to the appropriate input node
to match what the Wacom driver does and be more convenient for the users
to know which one is which.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@...hat.com>
---
 drivers/hid/hid-huion.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/hid/hid-huion.c b/drivers/hid/hid-huion.c
index 50fbda4..f298f66 100644
--- a/drivers/hid/hid-huion.c
+++ b/drivers/hid/hid-huion.c
@@ -142,6 +142,33 @@ static __u8 *huion_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 	return rdesc;
 }
 
+static void huion_input_configured(struct hid_device *hdev,
+		struct hid_input *hi)
+{
+	char *name;
+	const char *suffix = NULL;
+	struct hid_field *field = hi->report->field[0];
+
+	switch (field->application) {
+	case HID_GD_KEYPAD:
+		suffix = "Pad";
+		break;
+	case HID_DG_PEN:
+		suffix = "Pen";
+		break;
+	}
+
+	if (suffix) {
+		name = devm_kzalloc(&hi->input->dev,
+				    strlen(hdev->name) + strlen(suffix) + 2,
+				    GFP_KERNEL);
+		if (name) {
+			sprintf(name, "%s %s", hdev->name, suffix);
+			hi->input->name = name;
+		}
+	}
+}
+
 /**
  * Enable fully-functional tablet mode and determine device parameters.
  *
@@ -282,6 +309,9 @@ static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id)
 				hid_err(hdev, "tablet enabling failed\n");
 				return rc;
 			}
+			hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+		} else {
+			return -ENODEV;
 		}
 		break;
 	}
@@ -335,6 +365,7 @@ static struct hid_driver huion_driver = {
 	.probe = huion_probe,
 	.report_fixup = huion_report_fixup,
 	.raw_event = huion_raw_event,
+	.input_configured = huion_input_configured,
 };
 module_hid_driver(huion_driver);
 
-- 
2.1.0

--
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