Bug 288179

Summary: Keyboard backlight support
Product: [Frameworks and Libraries] solid Reporter: Corentin Chary <corentin.chary>
Component: powermanagementAssignee: Dario Freddi <drf>
Status: RESOLVED FIXED    
Severity: wishlist CC: adaptee, alarmfifa, and, kde, mensoif_gerard, oleksii.zagorskyi, poletti.marco, rudd-o, wporta
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.11

Description Corentin Chary 2011-12-04 08:51:38 UTC
Version:           unspecified (using Devel) 
OS:                Linux

More and more laptop are comming with keyboard backlight and currently KDE doesn't handle keyboard backlight at all.

Xorg have the following keys:
#define XF86XK_KbdLightOnOff       0x1008FF04
#define XF86XK_KbdBrightnessUp     0x1008FF05
#define XF86XK_KbdBrightnessDown   0x1008FF06

And those are mapped in Qt:
    { Qt::Key_KeyboardLightOnOff,  XF86XK_KbdLightOnOff },
    { Qt::Key_KeyboardBrightnessUp,  XF86XK_KbdBrightnessUp },
    { Qt::Key_KeyboardBrightnessDown,  XF86XK_KbdBrightnessDown },

On Linux, keyboard backlight is exposed as a led (/sys/class/led) with a name ending with ::kbd_backlight and the ABI is described here: https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-class-led

Currently, the following drivers export such a backlight: asus-wmi, asus-laptop, samsung-laptop (not merged yet, but probably in 3.3), applesmc. So if you have a samsung, asus or apple laptop with a keyboard backlight, it should be supported (if not, please ping me).

The code should be easy to write using the existing code for brightness (except that xrandr can't be used here, but upower/backlighthelper handle /sys/class/backlight/ directly). Unfortunatly I don't have enought time to do it alone (writting the Linux drivers already eats a lot of my free time), but I've got two laptops with keyboard backlight and I'll be happy to test anything.


Reproducible: Didn't try

Steps to Reproduce:
- Press Keyboard Brightness Up/Down

Actual Results:  
- Nothing

Expected Results:  
- The keyboard brightness is changed
- A nice OSD popup and show the current level
Comment 1 Dario Freddi 2011-12-05 16:40:43 UTC
Thanks for the info, will get to that as soon as I have a minute and provide you with a patch against 4.8 to test.
Comment 2 Corentin Chary 2011-12-06 07:33:28 UTC
Just found that upower supports keyboard backlight:
http://cgit.freedesktop.org/upower/tree/src/org.freedesktop.UPower.KbdBacklight.xml
http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c

Should be a lot easier with that already done :). Note that gnome-power-manager use that to control keyboard backlight too.
Comment 3 Corentin Chary 2012-02-03 07:54:37 UTC
Dario, any news on that? Thanks!
Comment 4 Manuel Amador (Rudd-O) 2012-03-01 15:55:39 UTC
Any news here?  I have the same problem.
Comment 5 Manuel Amador (Rudd-O) 2012-03-01 16:01:38 UTC
I confirm that upower works perfectly and that xev recognizes the keyboard backlight keys.
Comment 6 Corentin Chary 2012-07-16 04:35:21 UTC
Any news here ?
Comment 7 Wilfredo Porta 2012-07-16 19:53:26 UTC
I have an Asus G74SX-DH71 and the Keyboard Brightness Up/Down don't work. The Screen Brightness Up/Down do work but not the Keyboard lights.

Any help on getting this working?

Thanks.
Comment 8 Corentin Chary 2012-07-16 20:19:27 UTC
The simpliest way with KDE is probably to use xvindkey + home-made scripts controling /sys/class/led/asus::kbd_backlight or upower.
Comment 9 Wilfredo Porta 2012-07-16 20:40:56 UTC
Thanks for your response.

Any idea on how this "home-made scripts" should look like?

In Gnome3 these key works just fine.

Do you think that having gnome-settings-daemon stared automatically could help?
Comment 10 Oleksiy Zagorskyi 2012-10-04 11:31:56 UTC
*** This bug has been confirmed by popular vote. ***
Comment 11 Oleksiy Zagorskyi 2012-10-04 11:42:13 UTC
I have an Asus UX32VD, kernel 3.5.3, KDE 4.8.4
Keyboard Brightness Up/Down (Fn+F4, Fn+F3) don't work under KDE but they work under Gnome3.
I can successfully change it by sending 0-3:
# echo 3 > /sys/class/leds/asus\:\:kbd_backlight/brightness

Would be very nice to have it working natively under KDE.
Comment 12 Marco Poletti 2012-10-21 15:42:51 UTC
I would be interested in contributing some code to fix this.
Can some developer give me a few pointers to get started?

I already have C++ and Qt coding experience, but no KDE experience.
Comment 13 Andreas Lauser 2013-01-06 20:51:32 UTC
I've just uploaded a patch for this to reviewboard, see 

https://git.reviewboard.kde.org/r/108232/

Let's hope it will go into 4.11. Note that his patch adds support for the keyboard backlight control keys, it neither adds any GUI to powerdevil and system settings nor does it add keyboard backlight support for power profiles.
Comment 14 Kai Uwe Broulik 2013-03-20 21:14:38 UTC
This review has been submitted with commit d9f08307177fd56d98b58dfe87cbea062a1516e0 by Michael Zanetti to branch master.