asus-wmi: kbd backlight brightness keys not forwarded as input events
There is a bug in asus-wmi's handling of keyboard backlight brightness keys.
== Problem: WMI key events 0xc4/0xc5/0xc7 are not forwarded as input events ==
In asus_wmi_notify() (asus-wmi.c, around line 4551), when the driver receives NOTIFY_KBD_BRTUP (0xc4), NOTIFY_KBD_BRTDWN (0xc5), or NOTIFY_KBD_BRTTOGGLE (0xc7), it calls kbd_led_set_by_kbd() and immediately returns without calling input_report_key(). No EV_KEY event is ever delivered to /dev/input.
The conventional behavior (as seen in thinkpad_acpi, dell-wmi, etc.) is to emit the corresponding input event after handling the brightness change internally, so that the keystroke remains visible to userspace.
== Impact ==
1. Wayland compositors and other userspace tools cannot bind or react to these keys, since no input event is generated.
2. Because the driver only updates its internal state variable (kbd_led_wk) without emitting input events, userspace has no way to observe brightness changes or persist them. As a result, /sys/class/leds/asus::kbd_backlight/brightness is always 0 after boot, regardless of the value set in the previous session.
== Suggested fix ==
After calling kbd_led_set_by_kbd(), emit the corresponding input event (KEY_KBDILLUMUP / KEY_KBDILLUMDOWN) before returning, instead of returning silently.
== Hardware ==
Model: ASUS ROG Strix G16 G614FR
Kernel: Linux 7.0.3-zen1-2-zen x86_64
USB ID: 0b05:19b6 ASUSTek Computer, Inc. [N-KEY Device]
/sys/class/leds/asus::kbd_backlight/max_brightness: 3 /sys/class/leds/asus::kbd_backlight/brightness: 0 (always after boot)
Am 06.05.26 um 14:02 schrieb 汪浩然:
Quoted 23 lines
There is a bug in asus-wmi's handling of keyboard backlight brightness keys.
== Problem: WMI key events 0xc4/0xc5/0xc7 are not forwarded as input
events ==In
asus_wmi_notify()(asus-wmi.c, around line 4551), when the driver
receives
NOTIFY_KBD_BRTUP (0xc4),NOTIFY_KBD_BRTDWN(0xc5), orNOTIFY_KBD_BRTTOGGLE
(0xc7), it callskbd_led_set_by_kbd()and immediately returns without
calling
input_report_key(). NoEV_KEYevent is ever delivered to/dev/input.The conventional behavior (as seen in
thinkpad_acpi, dell-wmi, etc.)
is to
emit the corresponding input event after handling the brightness change internally, so that the keystroke remains visible to userspace.== Impact ==
1. Wayland compositors and other userspace tools cannot bind or react to these keys, since no input event is generated.
Quoted 7 lines
2. Because the driver only updates its internal state variable
(kbd_led_wk)
without emitting input events, userspace has no way to observe
brightness
changes or persist them. As a result, /sys/class/leds/asus::kbd_backlight/brightness is always 0 after boot, regardless of the value set in the previous session.
Hi,
this driver uses the "brightness_hw_changed" sysfs attribute of the LED device to signal changes (using poll() notifications) to the LED brightness caused by hotkeys. Emitting an additional input event might cause userspace to increase the LED brightness a second time, so we cannot do this.
What do you want to archive exactly?
Thanks,
Armin Wolf
Quoted 17 lines
== Suggested fix ==
After calling
kbd_led_set_by_kbd(), emit the corresponding input event (KEY_KBDILLUMUP/KEY_KBDILLUMDOWN) before returning, instead of
returning
silently.== Hardware ==
Model: ASUS ROG Strix G16 G614FR
Kernel: Linux 7.0.3-zen1-2-zenx86_64
USB ID: 0b05:19b6 ASUSTek Computer, Inc. [N-KEY Device]/sys/class/leds/asus::kbd_backlight/max_brightness: 3 /sys/class/leds/asus::kbd_backlight/brightness: 0 (always after boot)