Linux Input/HID development
 help / color / mirror / Atom feed
From: Ryan Doupe <ryan.doupe@gmail.com>
To: linux-input@vger.kernel.org
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	"Luke D . Jones" <luke@ljones.dev>,
	Denis Benato <denis.benato@linux.dev>,
	Ryan Doupe <ryan.doupe@gmail.com>
Subject: [PATCH] HID: asus: pass through ROG N-Key Win-lock reports
Date: Thu, 10 Sep 2026 01:53:03 -0400	[thread overview]
Message-ID: <20260910055303.1238743-1-ryan.doupe@gmail.com> (raw)

The ASUS ROG Zephyrus G16 (USB 0b05:19b6) reports its Win-key lock
state using a vendor-defined input report:

  5d bf 01 01  lock
  5d bf 01 00  unlock

The firmware sends these reports when Fn+Super changes the lock state.
While locked, it also repeats the lock report when Super is pressed and
suppressed.

hid-asus filters all reports with ID 0x5d or 0x5e as continuous AURA
echoes. Since the driver's raw_event callback runs before the HID core
delivers reports to hidraw, this also prevents userspace from observing
the firmware-managed lock state.

Pass only 5d bf 01 xx reports through on the USB ROG N-Key Keyboard2.
Continue filtering all other 0x5d reports and all 0x5e reports.

Tested on an ASUS ROG Zephyrus G16 (0b05:19b6) by reading lock and
unlock notifications from hidraw while the EC suppressed and restored
KEY_LEFTMETA.

Assisted-by: LLM
Signed-off-by: Ryan Doupe <ryan.doupe@gmail.com>
---
 drivers/hid/hid-asus.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index c38a2b3b..7e2eed8f 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -100,6 +100,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 #define QUIRK_ROG_ALLY_XPAD		BIT(13)
 #define QUIRK_HID_FN_LOCK		BIT(14)
 #define QUIRK_FILTER_CAMERA_COMPANION	BIT(15)
+#define QUIRK_HID_WIN_LOCK		BIT(16)
 
 #define I2C_KEYBOARD_QUIRKS			(QUIRK_FIX_NOTEBOOK_REPORT | \
 						 QUIRK_NO_INIT_REPORTS | \
@@ -505,6 +506,16 @@ static int asus_raw_event(struct hid_device *hdev,
 	if (drvdata->quirks & QUIRK_MEDION_E1239T)
 		return asus_e1239t_event(drvdata, data, size);
 
+	/*
+	 * Report 0x5d normally carries a continuous stream of AURA echoes.
+	 * Win-key lock notifications use opcode 0xbf; pass those to hidraw.
+	 */
+	if ((drvdata->quirks & QUIRK_HID_WIN_LOCK) &&
+	    size >= 4 &&
+	    data[0] == FEATURE_KBD_LED_REPORT_ID1 &&
+	    data[1] == 0xbf && data[2] == 0x01)
+		return 0;
+
 	/*
 	 * Skip these report ID, the device emits a continuous stream associated
 	 * with the AURA mode it is in which looks like an 'echo'.
@@ -1689,7 +1700,8 @@ static const struct hid_device_id asus_devices[] = {
 	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2),
-	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_HID_FN_LOCK },
+	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD |
+		QUIRK_HID_FN_LOCK | QUIRK_HID_WIN_LOCK },
 	{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2),
 	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_HID_FN_LOCK },
-- 
2.55.0


                 reply	other threads:[~2026-09-10  5:53 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=20260910055303.1238743-1-ryan.doupe@gmail.com \
    --to=ryan.doupe@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=denis.benato@linux.dev \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=luke@ljones.dev \
    /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