* [PATCH v2 1/2] platform/x86: msi-wmi: Reformat msi_wmi_notify()
2026-06-13 2:16 [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models Derek J. Clark
@ 2026-06-13 2:16 ` Derek J. Clark
2026-06-13 2:16 ` [PATCH v2 2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys Derek J. Clark
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Derek J. Clark @ 2026-06-13 2:16 UTC (permalink / raw)
To: Ilpo Järvinen, Hans de Goede
Cc: Armin Wolf, Derek J . Clark, Pierre-Loup A . Griffais,
Thomas Renninger, platform-driver-x86, linux-kernel
Reformats msi_wmi_notify() to use a switch statement that reduces nesting
and prepares the function to support additional ACPI types.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
---
drivers/platform/x86/msi-wmi.c | 71 +++++++++++++++++++---------------
1 file changed, 39 insertions(+), 32 deletions(-)
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index 4a7ac85c4db4..d00ced756581 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -172,44 +172,51 @@ static const struct backlight_ops msi_backlight_ops = {
static void msi_wmi_notify(union acpi_object *obj, void *context)
{
- struct key_entry *key;
+ struct key_entry *key = NULL;
+ int eventcode = 0;
- if (obj && obj->type == ACPI_TYPE_INTEGER) {
- int eventcode = obj->integer.value;
+ if (!obj)
+ return;
+
+ switch (obj->type) {
+ case ACPI_TYPE_INTEGER:
+ eventcode = obj->integer.value;
pr_debug("Eventcode: 0x%x\n", eventcode);
- key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev,
- eventcode);
- if (!key) {
- pr_info("Unknown key pressed - %x\n", eventcode);
+ break;
+ default:
+ pr_info("Unknown event received\n");
+ return;
+ }
+
+ key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev, eventcode);
+
+ if (!key) {
+ pr_info("Unknown key pressed - 0x%x\n", eventcode);
+ return;
+ }
+
+ if (event_wmi->quirk_last_pressed) {
+ ktime_t cur = ktime_get_real();
+ ktime_t diff = ktime_sub(cur, last_pressed);
+ /* Ignore event if any event happened in a 50 ms
+ * timeframe -> Key press may result in 10-20 GPEs
+ */
+ if (ktime_to_us(diff) < 1000 * 50) {
+ pr_debug("Suppressed key event 0x%X - Last press was %lld us ago\n",
+ key->code, ktime_to_us(diff));
return;
}
+ last_pressed = cur;
+ }
- if (event_wmi->quirk_last_pressed) {
- ktime_t cur = ktime_get_real();
- ktime_t diff = ktime_sub(cur, last_pressed);
- /* Ignore event if any event happened in a 50 ms
- timeframe -> Key press may result in 10-20 GPEs */
- if (ktime_to_us(diff) < 1000 * 50) {
- pr_debug("Suppressed key event 0x%X - "
- "Last press was %lld us ago\n",
- key->code, ktime_to_us(diff));
- return;
- }
- last_pressed = cur;
- }
+ /* Brightness is served via acpi video driver */
+ if (key->type == KE_KEY &&
+ (backlight || (key->code == MSI_KEY_BRIGHTNESSUP ||
+ key->code == MSI_KEY_BRIGHTNESSDOWN)))
+ return;
- if (key->type == KE_KEY &&
- /* Brightness is served via acpi video driver */
- (backlight ||
- (key->code != MSI_KEY_BRIGHTNESSUP &&
- key->code != MSI_KEY_BRIGHTNESSDOWN))) {
- pr_debug("Send key: 0x%X - Input layer keycode: %d\n",
- key->code, key->keycode);
- sparse_keymap_report_entry(msi_wmi_input_dev, key, 1,
- true);
- }
- } else
- pr_info("Unknown event received\n");
+ pr_debug("Send key: 0x%X - Input layer keycode: %d\n", key->code, key->keycode);
+ sparse_keymap_report_entry(msi_wmi_input_dev, key, 1, true);
}
static int __init msi_wmi_backlight_setup(void)
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v2 2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys
2026-06-13 2:16 [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models Derek J. Clark
2026-06-13 2:16 ` [PATCH v2 1/2] platform/x86: msi-wmi: Reformat msi_wmi_notify() Derek J. Clark
@ 2026-06-13 2:16 ` Derek J. Clark
2026-06-20 0:07 ` [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models Armin Wolf
2026-07-01 11:30 ` Ilpo Järvinen
3 siblings, 0 replies; 5+ messages in thread
From: Derek J. Clark @ 2026-06-13 2:16 UTC (permalink / raw)
To: Ilpo Järvinen, Hans de Goede
Cc: Armin Wolf, Derek J . Clark, Pierre-Loup A . Griffais,
Thomas Renninger, platform-driver-x86, linux-kernel
MSI Claw devices produce WMI events through the MSI WMI hotkeys GUID for
some of their buttons. When pressed, these cause spam in the kernel. For
the majority of devices these events can be safely ignored as they are
duplicated by the AT Translated Set 2 Keyboard device exposed as an
evdev. For the MSI Claw A8 BZ2EM model's M-Center Menu button (left of
the screen) there is no associated keyboard event, so this event must be
exposed. Map this button to the same scancode produced by the AT
Keyboard device on other models. This does cause double F15 events on
the A1M, 7 AI+ A2VM, and 8 AI+ A2VM, but it appears to be harmless in my
testing.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
---
v2:
- Add comments explaining buffer fields & length.
- Test that we have at lease u8[2] before assignment of key ID
---
drivers/platform/x86/msi-wmi.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index d00ced756581..c9db750fe5ae 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -46,6 +46,12 @@ enum msi_scancodes {
WIND_KEY_WLAN = 0x5f, /* Fn+F11 Wi-Fi toggle */
WIND_KEY_TURBO, /* Fn+F10 turbo mode toggle */
WIND_KEY_ECO = 0x69, /* Fn+F10 ECO mode toggle */
+ /* MSI Claw keys */
+ CLAW_KEY_VOLUMEDOWN = 0x21,
+ CLAW_KEY_CENTER = 0x29, /* MSI M-Center main menu */
+ CLAW_KEY_QUICK_LONG = 0x2a, /* MSI M-Center quick access long hold */
+ CLAW_KEY_VOLUMEUP = 0x32,
+ CLAW_KEY_QUICK_SHORT = 0x58, /* MSI M-Center quick access short press */
};
static struct key_entry msi_wmi_keymap[] = {
{ KE_KEY, MSI_KEY_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
@@ -69,6 +75,15 @@ static struct key_entry msi_wmi_keymap[] = {
{ KE_KEY, WIND_KEY_TURBO, {KEY_PROG1} },
{ KE_KEY, WIND_KEY_ECO, {KEY_PROG2} },
+ /* These are MSI Claw keys, used for MSI M-Center in Windows */
+ { KE_KEY, CLAW_KEY_CENTER, {KEY_F15} },
+
+ /* These MSI Claw keys work without WMI. Ignore them to avoid double keycodes */
+ { KE_IGNORE, CLAW_KEY_QUICK_SHORT },
+ { KE_IGNORE, CLAW_KEY_QUICK_LONG },
+ { KE_IGNORE, CLAW_KEY_VOLUMEUP },
+ { KE_IGNORE, CLAW_KEY_VOLUMEDOWN },
+
{ KE_END, 0 }
};
@@ -183,6 +198,17 @@ static void msi_wmi_notify(union acpi_object *obj, void *context)
eventcode = obj->integer.value;
pr_debug("Eventcode: 0x%x\n", eventcode);
break;
+ case ACPI_TYPE_BUFFER:
+ /* Field returns u8[2] here, but is u32 by spec. Allow "oversized" buffers. */
+ if (obj->buffer.length < 2)
+ return;
+
+ /* pointer[0] is key ID, pointer[1] is active state. We don't get release
+ * events, so ignore the active state and treat as autorelease.
+ */
+ eventcode = obj->buffer.pointer[0];
+ pr_debug("Eventcode: 0x%x\n", eventcode);
+ break;
default:
pr_info("Unknown event received\n");
return;
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models
2026-06-13 2:16 [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models Derek J. Clark
2026-06-13 2:16 ` [PATCH v2 1/2] platform/x86: msi-wmi: Reformat msi_wmi_notify() Derek J. Clark
2026-06-13 2:16 ` [PATCH v2 2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys Derek J. Clark
@ 2026-06-20 0:07 ` Armin Wolf
2026-07-01 11:30 ` Ilpo Järvinen
3 siblings, 0 replies; 5+ messages in thread
From: Armin Wolf @ 2026-06-20 0:07 UTC (permalink / raw)
To: Derek J. Clark, Ilpo Järvinen, Hans de Goede
Cc: Pierre-Loup A . Griffais, Thomas Renninger, platform-driver-x86,
linux-kernel
Am 13.06.26 um 04:16 schrieb Derek J. Clark:
> MSI Claw devices produce WMI events through the MSI WMI hotkeys GUID for
> some of their buttons. When pressed, these cause spam in the kernel. The
> Claws use a GUID already supported by msi-wmi, but use an
> ACPI_TYPE_BUFFER instead of an ACPI_TYPE_INTEGER.
>
> Patch 1 reformats msi_wmi_notify() to reduce nesting by using early
> returns and a switch case in preparation for handling this new data
> type.
>
> Patch 2 adds known MSI Claw event keycodes to the keymap and support for
> ACPI_TYPE_BUFFER.
For the whole series:
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
>
> Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
> ---
> v2:
> - Add comments explaining buffer fields & length.
> - Test that we have at lease u8[2] before assignment of key ID
> v1: https://lore.kernel.org/platform-driver-x86/20260611223920.1679438-1-derekjohn.clark@gmail.com/
> Derek J. Clark (2):
> platform/x86: msi-wmi: Reformat msi_wmi_notify()
> platform/x86: msi-wmi: Add MSI Claw M-Center keys
>
> drivers/platform/x86/msi-wmi.c | 97 +++++++++++++++++++++++-----------
> 1 file changed, 65 insertions(+), 32 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models
2026-06-13 2:16 [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models Derek J. Clark
` (2 preceding siblings ...)
2026-06-20 0:07 ` [PATCH v2 0/2] platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models Armin Wolf
@ 2026-07-01 11:30 ` Ilpo Järvinen
3 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2026-07-01 11:30 UTC (permalink / raw)
To: Hans de Goede, Derek J. Clark
Cc: Armin Wolf, Pierre-Loup A . Griffais, Thomas Renninger,
platform-driver-x86, linux-kernel
On Fri, 12 Jun 2026 19:16:52 -0700, Derek J. Clark wrote:
> MSI Claw devices produce WMI events through the MSI WMI hotkeys GUID for
> some of their buttons. When pressed, these cause spam in the kernel. The
> Claws use a GUID already supported by msi-wmi, but use an
> ACPI_TYPE_BUFFER instead of an ACPI_TYPE_INTEGER.
>
> Patch 1 reformats msi_wmi_notify() to reduce nesting by using early
> returns and a switch case in preparation for handling this new data
> type.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent or clearly a regression fix.
The list of commits applied:
[1/2] platform/x86: msi-wmi: Reformat msi_wmi_notify()
commit: 43a862be3002ac9385cee76da9b403d6107c890b
[2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys
commit: 0c716d1848ac86cd4aa4ea2a997bf1e835017869
--
i.
^ permalink raw reply [flat|nested] 5+ messages in thread