linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vinicius A. Reis" <angiolucci@gmail.com>
To: jikos@kernel.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Vinicius A. Reis" <angiolucci@gmail.com>
Subject: [PATCH] HID: hid-asus: Maps 0x35 to KEY_SCREENLOCK
Date: Mon, 18 Oct 2021 09:51:10 -0300	[thread overview]
Message-ID: <20211018125110.3224-1-angiolucci@gmail.com> (raw)

Asus laptops are able to turn both the display and keyboard backlit off
by pressing a dedicated "turn display off" key (usually fn+f6). However,
on Linux systems, this key has no effect at all since most desktop
environments don't deal with KEY_DISPLAY_OFF. By mapping that key to
KEY_SCREENLOCK instead, would enable it to work as close as intended by
the manufacturer, since desktop envirorments would handle this as a
screen lock request by the user, locking the screen (and turning both
the display and keyboard backlit off on environments that support it).

Signed-off-by: Vinicius A. Reis <angiolucci@gmail.com>
---
 drivers/hid/hid-asus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index f3ecddc519ee..e5c7bfa68cd6 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -854,7 +854,9 @@ static int asus_input_mapping(struct hid_device *hdev,
 		switch (usage->hid & HID_USAGE) {
 		case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN);	break;
 		case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP);		break;
-		case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF);		break;
+		case 0x35:
+			asus_map_key_clear(KEY_SCREENLOCK);
+			break;
 		case 0x6c: asus_map_key_clear(KEY_SLEEP);		break;
 		case 0x7c: asus_map_key_clear(KEY_MICMUTE);		break;
 		case 0x82: asus_map_key_clear(KEY_CAMERA);		break;
-- 
2.32.0


                 reply	other threads:[~2021-10-18 12:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211018125110.3224-1-angiolucci@gmail.com \
    --to=angiolucci@gmail.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;
as well as URLs for NNTP newsgroup(s).