platform/asus: asus-nb-wmi: Ignore GX651AR event 0x5e
PATCH v2 1/1 platform/asus: asus-nb-wmi: Ignore GX651AR event 0x5e
The ASUS ROG Zephyrus Duo GX651AR reports WMI event 0x5e when the detachable keyboard is attached or detached. The asus-nb-wmi driver also handles this event as a wireless-console enable event, where it can be interpreted as a wireless key event.
Add a model-specific quirk to ignore event 0x5e on the GX651AR. Keep handling of events 0x5d and 0x5f unchanged and leave other ASUS models unaffected.
---
Changes in v2:
- Rebase onto pdx86/platform-drivers-x86 review-ilpo-next.
- Adapt to the ASUS driver relocation into drivers/platform/asus/.
- Use matching lowercase Gmail addresses for From and Signed-off-by.
Testing:
- checkpatch.pl: zero errors, zero warnings, zero checks.
- Build-tested both asus-nb-wmi.o and asus-wmi.o.
- Hardware testing (v1): ASUS ROG Zephyrus Duo GX651AR, Fedora 44, kernel 7.2.11-200.fc44.x86_64, using a temporary out-of-tree module built from the v7.2.11 driver source with the KEYBOARD_KEY_5e hwdb override disabled. Keyboard detach/reattach and typing worked; Wi-Fi remained enabled, and evtest no longer reported scan code 0x5e.
drivers/platform/asus/asus-nb-wmi.c | 18 +++++++++++++++++- drivers/platform/asus/asus-wmi.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/platform/asus/asus-nb-wmi.c +17 -1
@@ -158,6 +158,10 @@ static struct quirk_entry quirk_asus_zenbook_duo_kbd = { .key_wlan_event = ASUS_WMI_KEY_IGNORE, }; +static struct quirk_entry quirk_asus_gx651ar = { + .ignore_wlan_enable_event = true, +}; +static struct quirk_entry quirk_asus_z13 = { .key_wlan_event =ASUS_WMI_KEY_ARMOURY , .tablet_switch_mode = asus_wmi_kbd_dock_devid,
@@ -598,6 +602,15 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_proart_px13, }, + { + .callback = dmi_matched, + .ident = "ASUS ROG Zephyrus Duo GX651AR", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), + DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus Duo GX651AR"), + }, + .driver_data = &quirk_asus_gx651ar, + }, {}, };
@@ -723,7 +736,10 @@ static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,case 0x5D :/* Wireless console Toggle */ case 0x5E :/* Wireless console Enable / Keyboard Attach, Detach */ case 0x5F :/* Wireless console Disable / Special Key */ -if (quirks->key_wlan_event) +/* The GX651AR reports event 0x5e on keyboard attach/detach. */ +if (*code ==0x5E && quirks->ignore_wlan_enable_event) + *code =ASUS_WMI_KEY_IGNORE ; +else if (quirks->key_wlan_event) *code = quirks->key_wlan_event;break ; }
drivers/platform/asus/asus-wmi.h +3 -0
@@ -53,6 +53,9 @@ struct quirk_entry {*/ int no_display_toggle;u32 xusb2pr; + +/* Ignore event 0x5e when it represents keyboard attach/detach. */ +bool ignore_wlan_enable_event; };struct asus_wmi_driver {
base-commit: 6fc627bda235ac5b6f43b5f784b81d6c2450ae5a
Hi Ilpo,
I realized I accidentally omitted you from the recipients of my v2 submission. Adding you here for visibility.
I also wanted to share the successful hardware testing results.
Hardware testing:
- ASUS ROG Zephyrus Duo GX651AR.
- Fedora 45, kernel 7.3.6-300.fc45.x86_64.
- Built and loaded a modified asus-nb-wmi module using Fedora's matching 7.3.6 driver source.
- Keyboard detach/reattach and typing work correctly.
- Wi-Fi remains enabled and is no longer accidentally toggled.
- Restored the original Fedora driver after testing.
For clarity, this test used the equivalent GX651AR-specific fix adapted to Fedora's 7.3.6 driver source, rather than the newer upstream-tree module.
Thanks,
Cymirk