From: Hans de Goede <hansg@kernel.org>
To: Robin Everaars <robineveraars@pm.me>, ilpo.jarvinen@linux.intel.com
Cc: corentin.chary@gmail.com, luke@ljones.dev,
denis.benato@linux.dev, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] platform/x86: asus-wmi: accept either lid-flip notify code
Date: Mon, 10 Aug 2026 15:37:36 +0200 [thread overview]
Message-ID: <34eb08ed-5f3b-4312-84d4-fe91aebf104e@kernel.org> (raw)
In-Reply-To: <20260805141114.699959-3-robineveraars@pm.me>
Hi Robin,
On 5-Aug-26 4:11 PM, Robin Everaars wrote:
> 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 <robineveraars@pm.me>
nitpick: Something went wrong with the S-o-b line here
> ---
> 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 dce4d07..8b63fb4 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -820,6 +820,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" event
> 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;
> +}
This seems rather complicated, instead if adding this function please dropall usage of tablet_switch_event_code and ...
> @@ -4675,7 +4696,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;
> }
Replace the code check if condition with:
if (code == NOTIFY_KBD_DOCK_CHANGE ||
code == NOTIFY_LID_FLIP ||
code == NOTIFY_LID_FLIP_ROG) {
and update the commit message to match.
Regards,
Hans
prev parent reply other threads:[~2026-08-10 13:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 10:15 [PATCH 0/2] platform/x86: asus-wmi: make the tablet switch work on the ProArt PX13 Robin Everaars
2026-08-05 10:15 ` [PATCH 1/2] platform/x86: asus-wmi: keep the lid-flip state when UNKNOWN is set Robin Everaars
2026-08-05 12:07 ` Denis Benato
2026-08-10 13:20 ` Hans de Goede
2026-08-10 13:31 ` Denis Benato
2026-08-05 10:15 ` [PATCH 2/2] platform/x86: asus-wmi: accept either lid-flip notify code Robin Everaars
2026-08-05 12:11 ` Denis Benato
2026-08-05 14:11 ` [PATCH v2 0/2] platform/x86: asus-wmi: make the tablet switch work on the ProArt PX13 Robin Everaars
2026-08-05 14:11 ` [PATCH v2 1/2] platform/x86: asus-wmi: keep the lid-flip state when UNKNOWN is set Robin Everaars
2026-08-10 13:31 ` Hans de Goede
2026-08-05 14:11 ` [PATCH v2 2/2] platform/x86: asus-wmi: accept either lid-flip notify code Robin Everaars
2026-08-10 13:37 ` Hans de Goede [this message]
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=34eb08ed-5f3b-4312-84d4-fe91aebf104e@kernel.org \
--to=hansg@kernel.org \
--cc=corentin.chary@gmail.com \
--cc=denis.benato@linux.dev \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
--cc=robineveraars@pm.me \
/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
all inboxes | Powered by JetHome®