Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] HID: asus: pass through ROG N-Key Win-lock reports
@ 2026-09-10  5:53 Ryan Doupe
  0 siblings, 0 replies; only message in thread
From: Ryan Doupe @ 2026-09-10  5:53 UTC (permalink / raw)
  To: linux-input
  Cc: Jiri Kosina, Benjamin Tissoires, Luke D . Jones, Denis Benato,
	Ryan Doupe

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-10  5:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10  5:53 [PATCH] HID: asus: pass through ROG N-Key Win-lock reports Ryan Doupe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox