[PATCH 2/2] platform/x86: asus-wmi: accept either lid-flip notify code
Robin Everaars <[email protected]> Wed, 05 Aug 2026 10:15:21 +0000
| Newsgroups | org.kernel.vger.platform-driver-x86,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------482fba0ffd51ca37e22245b7eb20ad8ed69b51e468425191705343d84d5970e8 Content-Type: multipart/mixed; boundary=b2377afddfee960ad46b33fd48a2722905b7f618589918b65bfd0fa3a2f2 From: Robin Everaars <[email protected]> To: [email protected], [email protected] Cc: [email protected], [email protected], [email protected], [email protected], [email protected] Subject: [PATCH 2/2] platform/x86: asus-wmi: accept either lid-flip notify code Date: Wed, 5 Aug 2026 12:15:02 +0200 Message-ID: <[email protected]> X-Mailer: git-send-email 2.55.0 In-Reply-To: <[email protected]> References: <[email protected]> MIME-Version: 1.0 --b2377afddfee960ad46b33fd48a2722905b7f618589918b65bfd0fa3a2f2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit asus-wmi pairs the devid it polls for the tablet switch with the single notify code it listens for, and tablet_mode_sw only offers those fixed pairings. Some convertibles read the hinge at one lid-flip devid but notify with the other, which no value covers. The ASUS ProArt PX13 (HN7306EAC) is one. ASUS_WMI_DEVID_LID_FLIP is frozen at 1 in every pose while ASUS_WMI_DEVID_LID_FLIP_ROG tracks the hinge, yet folding notifies with NOTIFY_LID_FLIP rather than NOTIFY_LID_FLIP_ROG. So tablet_mode_sw=2 pins the switch on and suspends the internal keyboard for good, and tablet_mode_sw=3 reads the right devid but never hears the event. Accept either lid-flip code once a lid-flip switch is registered. Both are the same "lid flip action" event and both already map to KEY_PROG2 in the sparse keymap. Machines with a keyboard-dock switch notify with 0x75 and are unaffected, and with no switch registered the event code is 0 and the old equality test still runs. Signed-off-by: Robin Everaars <[email protected]> --- drivers/platform/x86/asus-wmi.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index f68fd2bcd..bcbb98529 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -819,6 +819,27 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus) asus_wmi_tablet_sw_report(asus, result); } +/* + * Some convertibles report the hinge at one lid-flip devid while their firmware + * notifies with the other lid-flip code, a pairing no tablet_mode_sw value + * covers. The ASUS ProArt PX13 (HN7306EAC) is one: ASUS_WMI_DEVID_LID_FLIP is + * frozen at 1 in every pose while ASUS_WMI_DEVID_LID_FLIP_ROG tracks the hinge, + * yet the fold notifies with NOTIFY_LID_FLIP rather than NOTIFY_LID_FLIP_ROG. + * Accept either code once a lid-flip switch is registered; both are the same + * "lid flip action" ev ent and both already map to KEY_PROG2 in the sparse keymap. + */ +static bool asus_wmi_is_tablet_switch_code(struct asus_wmi *asus, int code) +{ + if (code == asus->tablet_switch_event_code) + return true; + + if (asus->tablet_switch_event_code == NOTIFY_LID_FLIP || + asus->tablet_switch_event_code == NOTIFY_LID_FLIP_ROG) + return code == NOTIFY_LID_FLIP || code == NOTIFY_LID_FLIP_ROG; + + return false; +} + /* Charging mode, 1=Barrel, 2=USB ******************************************/ #if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) static ssize_t charge_mode_show(struct device *dev, @@ -4674,7 +4695,7 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus) return; } - if (code == asus->tablet_switch_event_code) { + if (asus_wmi_is_tablet_switch_code(asus, code)) { asus_wmi_tablet_mode_get_state(asus); return; } -- 2.55.0 --b2377afddfee960ad46b33fd48a2722905b7f618589918b65bfd0fa3a2f2 Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="publickey - [email protected] - 0x8B6BA132.asc"; name="publickey - [email protected] - 0x8B6BA132.asc" Content-Type: application/pgp-keys; filename="publickey - [email protected] - 0x8B6BA132.asc"; name="publickey - [email protected] - 0x8B6BA132.as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zZLQXBpOUJa Nm5RZ0JBTmhaCkZoTUZ6c3l6dTJZWXRhQjhTWXRWdGhKSjYvZUlRVFQ2VWRRRUlZc0YKPVlLaE0K LS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQ== --b2377afddfee960ad46b33fd48a2722905b7f618589918b65bfd0fa3a2f2-- --------482fba0ffd51ca37e22245b7eb20ad8ed69b51e468425191705343d84d5970e8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wqsEARYIAF0FgmpzDTkJEB3Ff2vLBhqKNRQAAAAAABwAEHNhbHRAbm90YXRp b25zLm9wZW5wZ3Bqcy5vcmdY5Yx7bG+TFxNM2ESh180yFiEEi2uhMrb2XujF nFjLHcV/a8sGGooAAEk3AP9ClF5NvWxfvKUrA3JCV2SAv59EQo63clyrUymr QDJPggEA37sJw0MLQzhmtdEGNSMWKODH8BXJWlKiuEvQkLNzIAU= =zcB1 -----END PGP SIGNATURE----- --------482fba0ffd51ca37e22245b7eb20ad8ed69b51e468425191705343d84d5970e8--