From: Pavel Machek <pavel@ucw.cz>
To: Mario Limonciello <superm1@kernel.org>
Cc: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"open list:INPUT (KEYBOARD, MOUSE, JOYSTICK,
TOUCHSCREEN)..." <linux-input@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"open list:AMD PMF DRIVER" <platform-driver-x86@vger.kernel.org>,
"Mario Limonciello" <mario.limonciello@amd.com>,
"Armin Wolf" <W_Armin@gmx.de>
Subject: Re: [PATCH v4 1/2] Input: Add a Kconfig to emulate KEY_SCREENLOCK with META + L
Date: Sat, 26 Apr 2025 10:15:16 +0200 [thread overview]
Message-ID: <aAyWFI+o/kU9hDVs@duo.ucw.cz> (raw)
In-Reply-To: <20250425162949.2021325-1-superm1@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2368 bytes --]
On Fri 2025-04-25 11:29:48, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> In the PC industry KEY_SCREENLOCK isn't used as frequently as it used
> to be. Modern versions of Windows [1], GNOME and KDE support "META" + "L"
> to lock the screen. Modern hardware [2] also sends this sequence of
> events for keys with a silkscreen for screen lock.
>
> Introduced a new Kconfig option that will change KEY_SCREENLOCK when
> emitted by driver to META + L.
Fix gnome and kde, do not break kernel...
Pavel
>
> +config INPUT_SCREENLOCK_EMULATION
> + bool "Pass KEY_SCREENLOCK as META + L"
> + help
> + Say Y here if you want KEY_SCREENLOCK to be passed to userspace as
> + META + L.
> +
> + If unsure, say Y.
> +
> comment "Input Device Drivers"
>
> source "drivers/input/keyboard/Kconfig"
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index dfeace85c4710..983e3c0f88e5f 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -370,6 +370,13 @@ void input_handle_event(struct input_dev *dev,
> }
> }
>
> +static void handle_screenlock_as_meta_l(struct input_dev *dev, unsigned int type,
> + int value)
> +{
> + input_handle_event(dev, type, KEY_LEFTMETA, value);
> + input_handle_event(dev, type, KEY_L, value);
> +}
> +
> /**
> * input_event() - report new input event
> * @dev: device that generated the event
> @@ -392,6 +399,12 @@ void input_event(struct input_dev *dev,
> {
> if (is_event_supported(type, dev->evbit, EV_MAX)) {
> guard(spinlock_irqsave)(&dev->event_lock);
> +#ifdef CONFIG_INPUT_SCREENLOCK_EMULATION
> + if (code == KEY_SCREENLOCK) {
> + handle_screenlock_as_meta_l(dev, type, value);
> + return;
> + }
> +#endif
> input_handle_event(dev, type, code, value);
> }
> }
> @@ -2134,6 +2147,13 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
>
> switch (type) {
> case EV_KEY:
> +#ifdef CONFIG_INPUT_SCREENLOCK_EMULATION
> + if (code == KEY_SCREENLOCK) {
> + __set_bit(KEY_L, dev->keybit);
> + __set_bit(KEY_LEFTMETA, dev->keybit);
> + break;
> + }
> +#endif
> __set_bit(code, dev->keybit);
> break;
>
--
I don't work for Nazis and criminals, and neither should you.
Boycott Putin, Trump, and Musk!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2025-04-26 8:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 16:29 Mario Limonciello
2025-04-25 16:29 ` [PATCH v4 2/2] platform/x86/amd: pmf: Use META + L for screen lock command Mario Limonciello
2025-04-26 8:15 ` Pavel Machek [this message]
2025-04-26 13:00 ` [PATCH v4 1/2] Input: Add a Kconfig to emulate KEY_SCREENLOCK with META + L Mario Limonciello
2025-04-26 18:41 ` Pavel Machek
2025-04-26 23:44 ` Mario Limonciello
2025-04-27 6:10 ` Pavel Machek
2025-04-27 12:15 ` Mario Limonciello
2025-04-28 5:30 ` Dmitry Torokhov
2025-04-28 5:51 ` Dmitry Torokhov
2025-04-28 13:50 ` Mario Limonciello
2025-04-28 14:10 ` Hans de Goede
2025-04-28 5:52 ` Pavel Machek
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=aAyWFI+o/kU9hDVs@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=Shyam-sundar.S-k@amd.com \
--cc=W_Armin@gmx.de \
--cc=dmitry.torokhov@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=superm1@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®