]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: asus: add support for the asus-wmi brightness handler
authorAntheas Kapenekakis <lkml@antheas.dev>
Thu, 22 Jan 2026 07:50:44 +0000 (08:50 +0100)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 28 Jan 2026 12:02:37 +0000 (14:02 +0200)
If the asus-wmi brightness handler is available, send the
keyboard brightness events to it instead of passing them
to userspace. If it is not, fall back to sending them to it.

Reviewed-by: Luke D. Jones <luke@ljones.dev>
Tested-by: Luke D. Jones <luke@ljones.dev>
Reviewed-by: Denis Benato <benato.denis96@gmail.com>
Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
Link: https://patch.msgid.link/20260122075044.5070-12-lkml@antheas.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/hid/hid-asus.c

index 415629ebee15efc2992ee2bd09d1358058fb3c39..f5c8df20b88bf9ecf0c8c5ead6900b27f960f62b 100644 (file)
@@ -324,6 +324,17 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field,
                         usage->hid & HID_USAGE);
        }
 
+       if (usage->type == EV_KEY && value) {
+               switch (usage->code) {
+               case KEY_KBDILLUMUP:
+                       return !asus_hid_event(ASUS_EV_BRTUP);
+               case KEY_KBDILLUMDOWN:
+                       return !asus_hid_event(ASUS_EV_BRTDOWN);
+               case KEY_KBDILLUMTOGGLE:
+                       return !asus_hid_event(ASUS_EV_BRTTOGGLE);
+               }
+       }
+
        return 0;
 }