HID: asus: map Consumer brightness usages on I2C keyboards
Subsystems (2)
PATCH 1/1 HID: asus: map Consumer brightness usages on I2C keyboards
Several ASUS laptops carry their keyboard on an I2C-HID device with ID 0B05:4B42, the same ID as the Zenbook A16 (UX3607OA), so they bind to hid-asus with I2C_KEYBOARD_QUIRKS since
commit 206107536018 ("HID: asus: support the Zenbook A16 (UX3607OA) keyboard").
Unlike the A16, which reports its brightness hotkeys on the ASUS vendor page, these keyboards report them as the standard Consumer usages Display Brightness Decrement (0x70) and Display Brightness Increment (0x6f) on report 3. I2C_KEYBOARD_QUIRKS includes QUIRK_NO_CONSUMER_USAGES, whose input mapping ignores every Consumer usage except mute and volume, so the brightness keys never produce input events. The keys work when the keyboard happens to be bound to hid-generic, which maps those usages by default, and stop working as soon as hid-asus claims the device.
Let the two display brightness usages through the filter so hid-input maps them to KEY_BRIGHTNESSUP and KEY_BRIGHTNESSDOWN. Keyboards that do not report them are unaffected.
Tested on two ASUS laptop models with this keyboard: with the keyboard bound to hid-asus, the brightness keys now adjust the panel brightness.
--- drivers/hid/hid-asus.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-asus.c +2 -0
@@ -1311,6 +1311,8 @@ static int asus_input_mapping(struct hid_device *hdev,case 0xe2 :/* Mute */ case 0xe9 :/* Volume up */ case 0xea :/* Volume down */ +case 0x6f :/* Display brightness increment */ +case 0x70 :/* Display brightness decrement */ return 0 ;default :/* Ignore dummy Consumer usages which make the
base-commit: f47d223627f80cb7a1eb14c585fe6cb35de5e984
Signature · 1 line
2.55.0
Quoted 14 lines · David Cemin
Several ASUS laptops carry their keyboard on an I2C-HID device with ID 0B05:4B42, the same ID as the Zenbook A16 (UX3607OA), so they bind to hid-asus with
I2C_KEYBOARD_QUIRKSsince
commit 206107536018 ("HID: asus: support the Zenbook A16 (UX3607OA) keyboard").Unlike the A16, which reports its brightness hotkeys on the ASUS vendor page, these keyboards report them as the standard Consumer usages Display Brightness Decrement (
0x70) and Display Brightness Increment (0x6f) on report 3.I2C_KEYBOARD_QUIRKSincludesQUIRK_NO_CONSUMER_USAGES, whose input mapping ignores every Consumer usage except mute and volume, so the brightness keys never produce input events. The keys work when the keyboard happens to be bound to hid-generic, which maps those usages by default, and stop working as soon as hid-asus claims the device.
Quoted 8 lines
Let the two display brightness usages through the filter so hid-input maps them to
KEY_BRIGHTNESSUPandKEY_BRIGHTNESSDOWN. Keyboards that do not report them are unaffected.Tested on two ASUS laptop models with this keyboard: with the keyboard bound to hid-asus, the brightness keys now adjust the panel brightness.
Signed-off-by David Cemin <[email protected]>
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs