Ubuntu – How to prevent the keyboard backlight from turning on when the laptop is woken from sleep


I have a Thinkpad 470 and I am running Ubuntu 16.04 LTS on it. I don't like to keep the keyboard backlight on during daytime because I want to save battery among other things. What I have noticed is that the backlight turns itself on even if it is woken up from a state where the screen was dimmed completely or system had gone to sleep due to inactivity. The issue is that in day time or in presence of bright lights I am unable to see the backlight is on, thus I don't switch it off and this drains the battery.
I want to be able to control this setting. How do I do this?

After searching a bit in the following location :


I found the following files:

rgh@arrakis:/sys/class/leds/tpacpi::kbd_backlight$ ls
brightness  brightness_hw_changed  device  max_brightness  
power  subsystem  trigger  uevent

From among these, the file trigger contains the following items inside:

[none] rfkill-any kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock 
kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock 
kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock AC-online 
BAT0-charging-or-full BAT0-charging BAT0-full 
BAT0-charging-blink-full-solid BAT1-charging-or-full 
BAT1-charging BAT1-full BAT1-charging-blink-full-solid usb-gadget 
usb-host disk-activity ide-disk mtd nand-disk cpu cpu0 cpu1 cpu2 cpu3 
panic bluetooth-power rfkill0 rfkill1 phy0rx phy0tx phy0assoc phy0radio 
hci0-power rfkill41

I am guessing something here needs to be removed to get the behaviour I am looking for? Can you please tell me if I am correct? How to get this done?

Best Answer

From this reddit post OP had opposite problem with lights always being turned off when resuming from suspend.

You can follow the same approach but change the 1 (on) to a 0 (off).

Find the folder /etc/systemd/system/sleep.target.wants/ and create kb_backlight_resume.service with these contents:

Description=Switch on keyboard backlight after resume

ExecStart=/bin/echo 0 > "/sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness"


I don't have a Thinkpad and my Dell backlight keyboard has different directory structures. I'm unable to test this for your environment. You might have to manually tweak the code if the directory names above are off.

Don't forget to reboot before testing suspend / resume.

If you have a Dell that doesn't have /etc/systemd/system/sleep.target.wants/ it can be enabled. For example see:

Related Question