From: Nikolai Kondrashov <spbnick@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Jiri Kosina <jkosina@suse.cz>
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] HID: huion: split the stylus and pad in 2 nodes
Date: Wed, 18 Feb 2015 12:17:01 +0200 [thread overview]
Message-ID: <54E4669D.50505@gmail.com> (raw)
In-Reply-To: <1424213653-5970-3-git-send-email-benjamin.tissoires@redhat.com>
On 02/18/2015 12:54 AM, Benjamin Tissoires wrote:
> 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.
This is very nice and a thing that users asked for and I wanted to add for a
long while. I overlooked the addition of the input_configured callback
support.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.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);
I would have preferred an snprintf here instead, with the buffer length
calculated once and specified explicitly.
> + 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);
>
>
Thanks, Benjamin!
Nick
next prev parent reply other threads:[~2015-02-18 10:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 22:54 [PATCH 0/2] HID: huion: add libinput support Benjamin Tissoires
2015-02-17 22:54 ` [PATCH 1/2] HID: huion: enable button mode reporting Benjamin Tissoires
2015-02-18 10:11 ` Nikolai Kondrashov
2015-02-18 20:24 ` Benjamin Tissoires
2015-02-19 11:37 ` Nikolai Kondrashov
2015-02-18 12:17 ` Nikolai Kondrashov
2015-02-18 20:25 ` Benjamin Tissoires
2015-02-17 22:54 ` [PATCH 2/2] HID: huion: split the stylus and pad in 2 nodes Benjamin Tissoires
2015-02-18 10:17 ` Nikolai Kondrashov [this message]
2015-02-18 9:25 ` [PATCH 0/2] HID: huion: add libinput support Nikolai Kondrashov
2015-02-18 20:04 ` Benjamin Tissoires
2015-02-19 11:54 ` Nikolai Kondrashov
2015-02-20 5:34 ` Peter Hutterer
2015-02-22 12:33 ` Nikolai Kondrashov
2015-02-22 23:28 ` Peter Hutterer
2015-02-23 22:34 ` Benjamin Tissoires
2015-02-24 11:22 ` Nikolai Kondrashov
2015-02-24 21:45 ` Peter Hutterer
2015-02-23 22:44 ` Benjamin Tissoires
2015-02-24 11:27 ` Nikolai Kondrashov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E4669D.50505@gmail.com \
--to=spbnick@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).