From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Hans de Goede <hdegoede@redhat.com>
Cc: linux-input@vger.kernel.org, Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: input: Add support for Programmable Buttons
Date: Wed, 19 May 2021 19:11:15 +0200 [thread overview]
Message-ID: <2acfc492-a8a9-4159-be49-dc4dc5d1614a@t-8ch.de> (raw)
In-Reply-To: <2dc197eb-a222-8af6-f0ab-f722e4f492ca@redhat.com>
Hi,
On Mi, 2021-05-19T18:13+0200, Hans de Goede wrote:
> Hi,
>
> On 5/19/21 6:03 PM, Thomas Weißschuh wrote:
> > From: Thomas Weißschuh <thomas@t-8ch.de>
> >
> > Map them to KEY_MACRO# event codes.
> >
> > These buttons are defined by HID as follows:
> > "The user defines the function of these buttons to control software
> > applications or GUI objects."
> >
> > This matches the semantics of the KEY_MACRO# input event codes that
> > Linux supports.
> >
> > Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
> > ---
> > drivers/hid/hid-debug.c | 11 +++++++++++
> > drivers/hid/hid-input.c | 1 +
> > 2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> > index 18f5e28d475c..7d4dee58d869 100644
> > --- a/drivers/hid/hid-input.c
> > +++ b/drivers/hid/hid-input.c
> > @@ -632,6 +632,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
> > else
> > code += BTN_TRIGGER_HAPPY - 0x10;
> > break;
> > + case HID_CP_CONSUMER_CONTROL: code += KEY_MACRO1; break;
>
> Shouldn't there be a check here to ensure that we don't map things above KEY_MACRO30 ?
> if we do that then we start hitting other codes like KEY_MACRO_RECORD_START and eventually
> BTN_TRIGGER_HAPPY and after the BTN_TRIGGER_HAPPY range we go over KEY_MAX which I think
> is not supported ?
>
> Regards,
>
> Hans
I thought all the other chunks of logic around this one would be affected by
this issue, too.
But actually it seems all the overflowing keys get first assigned to the
BTN_TRIGGER_HAPPY range and after that will be clipped directly by
map_key()/hid_map_usage().
I'll resend the patch.
Thanks,
Thomas
next prev parent reply other threads:[~2021-05-19 17:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 13:21 Handling of USB "Programmable button" controls as KEY_MACRO# events Thomas Weißschuh
2021-05-18 13:44 ` Hans de Goede
2021-05-19 16:03 ` [PATCH] HID: input: Add support for Programmable Buttons Thomas Weißschuh
2021-05-19 16:13 ` Hans de Goede
2021-05-19 17:11 ` Thomas Weißschuh [this message]
2021-05-19 17:43 ` [PATCH v2] " Thomas Weißschuh
2021-05-19 20:01 ` Hans de Goede
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=2acfc492-a8a9-4159-be49-dc4dc5d1614a@t-8ch.de \
--to=linux@weissschuh.net \
--cc=benjamin.tissoires@redhat.com \
--cc=hdegoede@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®