From: Hans de Goede <hdegoede@redhat.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
"Jiri Kosina" <jikos@kernel.org>,
"Benjamin Tissoires" <benjamin.tissoires@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Handling of USB "Programmable button" controls as KEY_MACRO# events
Date: Tue, 18 May 2021 15:44:52 +0200 [thread overview]
Message-ID: <61dcf8c7-2dcb-4173-fbbd-9adf3412edb7@redhat.com> (raw)
In-Reply-To: <6ebbb200-1f2c-450b-8fae-e5e2dd9b6be9@t-8ch.de>
Hi,
On 5/18/21 3:21 PM, Thomas Weißschuh wrote:
> Hi everybody,
>
> Would it make sense to map the "Programmable Buttons" control from the
> USB HID Consumer page [0] to the linux event codes KEY_MACRO1 ... KEY_MACRO# ?
>
> Those controls are documented in the USB spec as:
>
> "The user defines the function of these
> buttons to control software applications or GUI objects."
>
> The KEY_MACRO event codes are documented with:
>
> "Some keyboards have keys which do not have a defined meaning, these keys
> are intended to be programmed / bound to macros by the user."
>
> My usecase is the passing of custom keycodes from a programmable keypad
> (via QMK[1]) to Linux.
> (This would also need new functionality in QMK itself)
I think the idea is good, but AFAICT the HUT does not actually assign
any usage codes in the consumer-page for this. It simply points to the
Button usage-page, which means things conflict with e.g. mouse and joystick
buttons and I do not see any dedicated codes in the table
"Table 15.1: Consumer Page" so I'm not sure how to interpret the spec. here ...
I guess there is something which we can do with the report's application here,
since the code dealing with HID_UP_BUTTON is already doing a switch-case
on field->application to differentiate between mouse and gaming buttons.
I guess interpreting an application of HID_CP_CONSUMER_CONTROL in combination
with using the buttons usage-page as wat the HUT is trying to specify and
thus map that the first 30 codes in that combination to KEY_MACRO1 - 30
might make sense.
Regards,
Hans
>
> Alternatives:
>
> * Send Raw HID from QMK
> * Con: needs a dedicated, nonstandard driver on the host
> * Use F-Keys
> * Con: only F13-F19 are usable (F1-F12 are used by normal keyboards, F20-F23
> are repurposed with other keys for X11 compat)
>
> Possible problems:
>
> * There are 65k programmable keys defined by USB but only 30 macro keys are
> supported by Linux.
>
> Thanks,
> Thomas
>
> [0] https://www.usb.org/sites/default/files/hut1_22.pdf#section.15.14
> [1] https://qmk.fm/
>
next prev parent reply other threads:[~2021-05-18 13:45 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 [this message]
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
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=61dcf8c7-2dcb-4173-fbbd-9adf3412edb7@redhat.com \
--to=hdegoede@redhat.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@weissschuh.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).