platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models
Subsystems (2)
cover platform/x86: msi-wmi: Fix unknown wmi event messages on MSI Claw models
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.
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 | 92 ++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 32 deletions(-)
Signature · 1 line
2.54.0
PATCH 1/2 platform/x86: msi-wmi: Reformat msi_wmi_notify()
Reformats msi_wmi_notify() to use a switch statement that reduces nesting and prepares the function to support additional ACPI types.
--- drivers/platform/x86/msi-wmi.c | 71 +++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 32 deletions(-)
drivers/platform/x86/msi-wmi.c +39 -32
@@ -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 )
Signature · 1 line
2.54.0
PATCH 2/2 platform/x86: msi-wmi: Add MSI Claw M-Center keys
In reply to Derek J. ClarkMSI 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.
--- drivers/platform/x86/msi-wmi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/platform/x86/msi-wmi.c +22 -0
@@ -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,13 @@ 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 : +if (!obj->buffer.length) +return ; + + eventcode = obj->buffer.pointer[0 ]; +pr_debug ("Eventcode: 0x%x\n" , eventcode); +break ;default :pr_info ("Unknown event received\n" );return ;
Signature · 1 line
2.54.0
Am 12.06.26 um 00:39 schrieb Derek J. Clark:
Quoted 11 lines
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_BUFFERinstead of anACPI_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.
Would it be possible to turn this driver into a proper WMI driver using .notify_new()? This would solve the whole ACPI type problem.
Thanks,
Armin Wolf
Quoted 10 lines
Signed-off-by Derek J. Clark <[email protected]>Derek J. Clark (2):
platform/x86: msi-wmi: Reformatmsi_wmi_notify()platform/x86: msi-wmi: Add MSI Claw M-Center keysdrivers/platform/x86/msi-wmi.c | 92 ++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 32 deletions(-)
Quoted 12 lines · Armin Wolf
Am 12.06.26 um 00:39 schrieb Derek J. Clark:
Quoted 9 lines
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_BUFFERinstead of anACPI_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.
Quoted 6 lines
Quoted 2 lines
Patch 2 adds known MSI Claw event keycodes to the keymap and support for
ACPI_TYPE_BUFFER.Would it be possible to turn this driver into a proper WMI driver using .notify_new()? This would solve the whole ACPI type problem.
Hi Armin,
That would open up a huge can of worms that I'm not really able to manage right now. This driver seems to predate even the older wmi_dev standards (copyright is 2009) and I don't have any devices with the legacy interfaces.There are 3 standalone interfaces, the original WMI BIOS GUID, the backlight GUID, and the Wind GUID. The Claws only use the Wind GUID, but don't implement most of the buttons that were already in the driver, so I would be worried about regressions with the older interfaces. The driver is simple enough that I think we could get away with just one "modern" driver vice doing one for each GUID, but I'd also need to refactor everything to use drvdata instead of global vars so it could be instantiated multiple times. All of that seems like a lot of risk and effort to do what is effectively adding an event for 1 button on the A8 and silence some warnings for the rest of the line.
I just now realized I forgot to include the original author in this patch so I've added then to CC here (my apologies Thomas). If there is a v2 needed I'll include them going forward.
Thanks,
Derek
Quoted 13 lines
Thanks,
Armin WolfQuoted 10 lines
Signed-off-by Derek J. Clark <[email protected]>Derek J. Clark (2):
platform/x86: msi-wmi: Reformatmsi_wmi_notify()platform/x86: msi-wmi: Add MSI Claw M-Center keysdrivers/platform/x86/msi-wmi.c | 92 ++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 32 deletions(-)
Am 12.06.26 um 19:18 schrieb Derek John Clark:
Quoted 34 lines · Armin Wolf
Quoted 7 lines
Am 12.06.26 um 00:39 schrieb Derek J. Clark:
Quoted 5 lines
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_BUFFERinstead of anACPI_TYPE_INTEGER.Quoted 9 lines
Quoted 6 lines
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.Would it be possible to turn this driver into a proper WMI driver using .notify_new()? This would solve the whole ACPI type problem.
Hi Armin,
That would open up a huge can of worms that I'm not really able to manage right now. This driver seems to predate even the older
wmi_devstandards (copyright is 2009) and I don't have any devices with the legacy interfaces.There are 3 standalone interfaces, the original WMI BIOS GUID, the backlight GUID, and the Wind GUID. The Claws only use the Wind GUID, but don't implement most of the buttons that were already in the driver, so I would be worried about regressions with the older interfaces. The driver is simple enough that I think we could get away with just one "modern" driver vice doing one for each GUID, but I'd also need to refactor everything to use drvdata instead of global vars so it could be instantiated multiple times. All of that seems like a lot of risk and effort to do what is effectively adding an event for 1 button on the A8 and silence some warnings for the rest of the line.
Quoted 6 lines
I just now realized I forgot to include the original author in this patch so I've added then to CC here (my apologies Thomas). If there is a v2 needed I'll include them going forward.
Thanks,
Derek
No problem, i will see if i can get a MSI notebook somewhere to do this in the future.
Thanks,
Armin Wolf
Quoted 13 lines
Quoted 13 lines
Thanks,
Armin WolfQuoted 9 lines
Signed-off-by Derek J. Clark <[email protected]>Derek J. Clark (2):
platform/x86: msi-wmi: Reformatmsi_wmi_notify()platform/x86: msi-wmi: Add MSI Claw M-Center keysdrivers/platform/x86/msi-wmi.c | 92 ++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 32 deletions(-)
Re: [PATCH 2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys
In reply to Derek J. ClarkAm 12.06.26 um 00:39 schrieb Derek J. Clark:
Quoted 50 lines
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 <[email protected]>--- drivers/platform/x86/msi-wmi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/platform/x86/msi-wmi.c +15
-0@@ -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 } };
drivers/platform/x86/msi-wmi.c static void msi_wmi_notify(union acpi_object *obj, void *context) · line 206
Quoted 9 lines
drivers/platform/x86/msi-wmi.c +6
-0@@ -183,6 +198,13 @@ 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 : +if (!obj->buffer.length) +return ; + + eventcode = obj->buffer.pointer[0 ]; +pr_debug ("Eventcode: 0x%x\n" , eventcode);
Can you share the BMOF associated with this event? I suspect that the buffer should contain a u32.
Thanks,
Armin Wolf
Quoted 4 lines
drivers/platform/x86/msi-wmi.c +1
-0+break ;default :pr_info ("Unknown event received\n" );return ;
Re: [PATCH 2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys
Quoted 52 lines · Armin Wolf
Am 12.06.26 um 00:39 schrieb Derek J. Clark:
Quoted 49 lines
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 <[email protected]>--- drivers/platform/x86/msi-wmi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/platform/x86/msi-wmi.c +15
-0@@ -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 } };
Quoted 13 lines
drivers/platform/x86/msi-wmi.c static void msi_wmi_notify(union acpi_object *obj, void *context) · line 206
Quoted 10 lines
drivers/platform/x86/msi-wmi.c +6
-0@@ -183,6 +198,13 @@ 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 : +if (!obj->buffer.length) +return ; + + eventcode = obj->buffer.pointer[0 ]; +pr_debug ("Eventcode: 0x%x\n" , eventcode);Can you share the BMOF associated with this event? I suspect that the buffer should contain a u32.
The GUID's don't appear to contain any bmof data:
$ lsmod | grep bmof wmi_bmof 12288 0 wmi 32768 4 video,wmi_bmof,msi_wmi,msi_wmi_platform
$ tree -l -L 2
.
├── 1E2A0DA0-2B9E-424F-9C87-B1DAC3F4E9DA-3 ->
../../../devices/pci0000:00/0000:00:02.3/0000:c3:00.0/PNP0C14:01/wmi_bus/wmi_bus-PNP0C14:01/1E2A0DA0-2B9E-424F-9C87-B1DAC3F4E9DA-3
│ ├── driver_override
│ ├── expensive
│ ├── guid
│ ├── instance_count
│ ├── modalias
│ ├── notify_id
│ ├── power
│ ├── subsystem -> ../../../../../../../../bus/wmi
│ └── uevent
├── 5B3CC38A-40D9-7245-8AE6-1145B751BE3F-1 ->
../../../devices/pci0000:00/0000:00:14.3/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/5B3CC38A-40D9-7245-8AE6-1145B751BE3F-1
│ ├── driver_override
│ ├── expensive
│ ├── guid
│ ├── instance_count
│ ├── modalias
│ ├── notify_id
│ ├── power
│ ├── subsystem -> ../../../../../../../../bus/wmi
│ └── uevent
├── ABBC0F6E-8EA1-11D1-00A0-C90629100000-0 ->
../../../devices/pci0000:00/0000:00:14.3/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/ABBC0F6E-8EA1-11D1-00A0-C90629100000-0
│ ├── driver -> ../../../../../../../../bus/wmi/drivers/msi-wmi-platform
│ ├── driver_override
│ ├── expensive
│ ├── guid
│ ├── hwmon
│ ├── instance_count
│ ├── modalias
│ ├── object_id
│ ├── platform-profile
│ ├── power
│ ├── subsystem -> ../../../../../../../../bus/wmi
│ └── uevent
└── B2526ED4-CB45-49FA-9230-8D2FE8AFB8EC-2 ->
../../../devices/pci0000:00/0000:00:02.3/0000:c3:00.0/PNP0C14:01/wmi_bus/wmi_bus-PNP0C14:01/B2526ED4-CB45-49FA-9230-8D2FE8AFB8EC-2
├── driver_override
├── expensive
├── guid
├── instance_count
├── modalias
├── object_id
├── power
├── subsystem -> ../../../../../../../../bus/wmi
└── uevent16 directories, 28 files
I extracted the _WED event method from the DSDT. I don't have a lot of experience with interpreting ACPI, but my understanding is that it returns u8[2] with index 0 being the keycode and index 1 being the state. Since we don't get events on release, that is essentially unused. I can do a .length != 2 in the validation step before I extract the keycode if desired.
Method (_WED, 1, NotSerialized) // _Wxx: Wake Event, xx=0x00-0xFF
{
If ((Arg0 == 0xC0))
{
Name (EVRT, Buffer (0x02)
{
0x00, 0x00 // ..
})
Name (TMPB, Zero)
TMPB = WMRD (0xD8)
EVRT [Zero] = TMPB /* \_SB_.PCI0.SBRG.EC__.SCM0._WED.TMPB */
If ((TMPB == 0x08))
{
EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F
)
}
If ((TMPB == 0x56))
{
EVRT [One] = WMRD (0x2E)
}
If ((TMPB == 0x57))
{
EVRT [One] = WMRD (0x2E)
}
If ((TMPB == 0x5F))
{
EVRT [One] = WMRD (0x2E)
}
If ((TMPB == 0x60))
{
EVRT [One] = (WMRD (0xE4) & 0x07)
}
If ((TMPB == 0x62))
{
EVRT [One] = WMRD (0xD1)
}
If ((TMPB == 0x63))
{
EVRT [One] = WMRD (0xD1)
}
If ((TMPB == 0x73))
{
EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F
)
}
If ((TMPB == 0x79))
{
EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F
)
}
If ((TMPB == 0x7B))
{
EVRT [One] = WMRD (0x2E)
}
If ((TMPB == 0x84))
{
EVRT [One] = WMRD (0x2E)
}
If ((TMPB == 0x02))
{
EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F
)
}
WMWT (0xD8, Zero)
Return (EVRT) /* \_SB_.PCI0.SBRG.EC__.SCM0._WED.EVRT */
}
Return (Zero)
}Also the _WDG that points the Wind GUID to arg 0xC0:
Name (_WDG, Buffer (0x64)
{
/* 0000 */ 0x6A, 0x0F, 0xBC, 0xAB, 0xA1, 0x8E, 0xD1,
0x11, // j.......
/* 0008 */ 0x00, 0xA0, 0xC9, 0x06, 0x29, 0x10, 0x00,
0x00, // ....)...
/* 0010 */ 0x41, 0x4B, 0x01, 0x01, 0x6B, 0x0F, 0xBC,
0xAB, // AK..k...
/* 0018 */ 0xA1, 0x8E, 0xD1, 0x11, 0x00, 0xA0, 0xC9,
0x06, // ........
/* 0020 */ 0x29, 0x10, 0x00, 0x00, 0x41, 0x4C, 0x01,
0x01, // )...AL..
/* 0028 */ 0x6D, 0x0F, 0xBC, 0xAB, 0xA1, 0x8E, 0xD1,
0x11, // m.......
/* 0030 */ 0x00, 0xA0, 0xC9, 0x06, 0x29, 0x10, 0x00,
0x00, // ....)...
/* 0038 */ 0x41, 0x4A, 0x01, 0x02, 0x6E, 0x0F, 0xBC,
0xAB, // AJ..n...
/* 0040 */ 0xA1, 0x8E, 0xD1, 0x11, 0x00, 0xA0, 0xC9,
0x06, // ........
/* 0048 */ 0x29, 0x10, 0x00, 0x00, 0x41, 0x4D, 0x01,
0x02, // )...AM..
/* 0050 */ 0x8A, 0xC3, 0x3C, 0x5B, 0xD9, 0x40, 0x45,
0x72, // ..<[.@Er
/* 0058 */ 0x8A, 0xE6, 0x11, 0x45, 0xB7, 0x51, 0xBE,
0x3F, // ...E.Q.?
/* 0060 */ 0xC0, 0x00, 0x01, 0x09
// ....
})...
Thanks,
Derek
Quoted 7 lines
Thanks,
Armin WolfQuoted 4 lines
drivers/platform/x86/msi-wmi.c +1
-0+break ;default :pr_info ("Unknown event received\n" );return ;
Re: [PATCH 2/2] platform/x86: msi-wmi: Add MSI Claw M-Center keys
Am 12.06.26 um 20:25 schrieb Derek John Clark:
Quoted 126 lines · Armin Wolf
Quoted 52 lines
Am 12.06.26 um 00:39 schrieb Derek J. Clark:
Quoted 49 lines
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 <[email protected]>--- drivers/platform/x86/msi-wmi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/platform/x86/msi-wmi.c +15
-0@@ -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 } };Quoted 13 lines
drivers/platform/x86/msi-wmi.c static void msi_wmi_notify(union acpi_object *obj, void *context) · line 206
Quoted 10 lines
drivers/platform/x86/msi-wmi.c +6
-0@@ -183,6 +198,13 @@ 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 : +if (!obj->buffer.length) +return ; + + eventcode = obj->buffer.pointer[0 ]; +pr_debug ("Eventcode: 0x%x\n" , eventcode);Can you share the BMOF associated with this event? I suspect that the buffer should contain a u32.
The GUID's don't appear to contain any bmof data:
$ lsmod | grep bmof wmi_bmof 12288 0 wmi 32768 4 video,wmi_bmof,msi_wmi,msi_wmi_platform$ tree -l -L 2 . ├── 1E2A0DA0-2B9E-424F-9C87-B1DAC3F4E9DA-3 -> ../../../devices/pci0000:00/0000:00:02.3/0000:c3:00.0/PNP0C14:01/wmi_bus/wmi_bus-PNP0C14:01/1E2A0DA0-2B9E-424F-9C87-B1DAC3F4E9DA-3 │ ├── driver_override │ ├── expensive │ ├── guid │ ├── instance_count │ ├── modalias │ ├── notify_id │ ├── power │ ├── subsystem -> ../../../../../../../../bus/wmi │ └── uevent ├── 5B3CC38A-40D9-7245-8AE6-1145B751BE3F-1 -> ../../../devices/pci0000:00/0000:00:14.3/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/5B3CC38A-40D9-7245-8AE6-1145B751BE3F-1 │ ├── driver_override │ ├── expensive │ ├── guid │ ├── instance_count │ ├── modalias │ ├── notify_id │ ├── power │ ├── subsystem -> ../../../../../../../../bus/wmi │ └── uevent ├── ABBC0F6E-8EA1-11D1-00A0-C90629100000-0 -> ../../../devices/pci0000:00/0000:00:14.3/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/ABBC0F6E-8EA1-11D1-00A0-C90629100000-0 │ ├── driver -> ../../../../../../../../bus/wmi/drivers/msi-wmi-platform │ ├── driver_override │ ├── expensive │ ├── guid │ ├── hwmon │ ├── instance_count │ ├── modalias │ ├── object_id │ ├── platform-profile │ ├── power │ ├── subsystem -> ../../../../../../../../bus/wmi │ └── uevent └── B2526ED4-CB45-49FA-9230-8D2FE8AFB8EC-2 -> ../../../devices/pci0000:00/0000:00:02.3/0000:c3:00.0/PNP0C14:01/wmi_bus/wmi_bus-PNP0C14:01/B2526ED4-CB45-49FA-9230-8D2FE8AFB8EC-2 ├── driver_override ├── expensive ├── guid ├── instance_count ├── modalias ├── object_id ├── power ├── subsystem -> ../../../../../../../../bus/wmi └── uevent16 directories, 28 files
Quoted 6 lines
I extracted the
_WEDevent method from the DSDT. I don't have a lot of experience with interpreting ACPI, but my understanding is that it returns u8[2] with index 0 being the keycode and index 1 being the state. Since we don't get events on release, that is essentially unused. I can do a .length != 2 in the validation step before I extract the keycode if desired.
Oh right, i forgot that the MSI software contains the necessary BMOF data xd.
Anyway, here it is for the WIND event:
[WMI, Dynamic, Provider("WmiProv"), Local("MS\\0x409"), Description("Event defined by MSI"), guid("{5B3CC38A-40D9-7245-8AE6-1145B751BE3F}")] class MSI_Event : WMIEvent {
[key, read] string InstanceName;
[read] boolean Active;
[WmiDataId(1), read, write, Description("Event defined by MSI")]
uint32 MSIEvt;
};
So the event payload is indeed a plain u32. For some reason the Windows WMI stack accepts 2 byte buffers even when at least 4 are necessary. I have no idea why Windows does accept undersized data in this case, but i suggest you do the same.
So a length < 2 check (not !=, we need to still accept oversized buffers) like you described earlier should be enough. Just drop a comment somewhere that explains the meaning of index 1.
Thanks,
Armin Wolf
Quoted 128 lines
Method (
_WED, 1, NotSerialized) //_Wxx: Wake Event, xx=0x00-0xFF{ If ((Arg0 == 0xC0)) { Name (EVRT, Buffer (0x02) { 0x00, 0x00 // .. }) Name (TMPB, Zero) TMPB = WMRD (0xD8) EVRT [Zero] = TMPB /* \_SB_.PCI0.SBRG.EC__.SCM0._WED.TMPB */ If ((TMPB == 0x08)) { EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F ) } If ((TMPB == 0x56)) { EVRT [One] = WMRD (0x2E) } If ((TMPB == 0x57)) { EVRT [One] = WMRD (0x2E) } If ((TMPB == 0x5F)) { EVRT [One] = WMRD (0x2E) } If ((TMPB == 0x60)) { EVRT [One] = (WMRD (0xE4) & 0x07) } If ((TMPB == 0x62)) { EVRT [One] = WMRD (0xD1) } If ((TMPB == 0x63)) { EVRT [One] = WMRD (0xD1) } If ((TMPB == 0x73)) { EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F ) } If ((TMPB == 0x79)) { EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F ) } If ((TMPB == 0x7B)) { EVRT [One] = WMRD (0x2E) } If ((TMPB == 0x84)) { EVRT [One] = WMRD (0x2E) } If ((TMPB == 0x02)) { EVRT [One] = ((WMRD (0xE4) >> 0x03) & 0x1F ) } WMWT (0xD8, Zero) Return (EVRT) /* \_SB_.PCI0.SBRG.EC__.SCM0._WED.EVRT */ } Return (Zero) }Also the
_WDGthat points the Wind GUID to arg0xC0:Name (
_WDG, Buffer (0x64){ /* 0000 */ 0x6A, 0x0F, 0xBC, 0xAB, 0xA1, 0x8E, 0xD1, 0x11, // j....... /* 0008 */ 0x00, 0xA0, 0xC9, 0x06, 0x29, 0x10, 0x00, 0x00, // ....)... /* 0010 */ 0x41, 0x4B, 0x01, 0x01, 0x6B, 0x0F, 0xBC, 0xAB, // AK..k... /* 0018 */ 0xA1, 0x8E, 0xD1, 0x11, 0x00, 0xA0, 0xC9, 0x06, // ........ /* 0020 */ 0x29, 0x10, 0x00, 0x00, 0x41, 0x4C, 0x01, 0x01, // )...AL.. /* 0028 */ 0x6D, 0x0F, 0xBC, 0xAB, 0xA1, 0x8E, 0xD1, 0x11, // m....... /* 0030 */ 0x00, 0xA0, 0xC9, 0x06, 0x29, 0x10, 0x00, 0x00, // ....)... /* 0038 */ 0x41, 0x4A, 0x01, 0x02, 0x6E, 0x0F, 0xBC, 0xAB, // AJ..n... /* 0040 */ 0xA1, 0x8E, 0xD1, 0x11, 0x00, 0xA0, 0xC9, 0x06, // ........ /* 0048 */ 0x29, 0x10, 0x00, 0x00, 0x41, 0x4D, 0x01, 0x02, // )...AM.. /* 0050 */ 0x8A, 0xC3, 0x3C, 0x5B, 0xD9, 0x40, 0x45, 0x72, // ..<[.@Er /* 0058 */ 0x8A, 0xE6, 0x11, 0x45, 0xB7, 0x51, 0xBE, 0x3F, // ...E.Q.? /* 0060 */ 0xC0, 0x00, 0x01, 0x09 // .... })...
Thanks,
DerekQuoted 7 lines
Thanks,
Armin WolfQuoted 4 lines
drivers/platform/x86/msi-wmi.c +1
-0+break ;default :pr_info ("Unknown event received\n" );return ;