6

I have a Samsung Notebook 7 spin 15.6" FHD Touch NP740U5L-Y02US - i7-6500U - 12GB - 1TB set up dual boot Windows 10 and Ubuntu 16.04.

Function Key + F9 is supposed to control keyboard backlight, but it does not do anything. The keyboard backlight is always on. I know that Ubuntu can control the backlight because when I shine a flashlight directly on the sensor, the backglight turns off. However when I remove the flashlight the backlight goes on again.

How can I manually control the backlight (either by the function key or other way)?

Thing's I've looked at:

  • I have looked at my /sys/class folder and in there I see a folder called backlight which has settings for the screen brightness, and a folder called leds which has settings indicator lights for things like caps lock. I thought the keyboard light settings might be in the leds folder but I don't see that there. Like I said, I know Ubuntu can control my keyboard light via the light sensor but I need to control it manually.

  • I have also tried xset led cycling through numbers 1-32. I have also tried editing the GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" line in /etc/default/grub all with no success.

  • I have tried installing the samsung tools package (https://answers.launchpad.net/samsung-tools/+question/289901) but using that I get the message Backlight cannot be disabled

  • asus-keyboard-backlight.sh exists in /etc/acpi and the script includes reference to KEYS_DIR=/sys/class/leds/asus\:\:kbd_backlight but that file does not exist.

  • If I run acpi_listen and hit Fn-F9 (that's supposed to be mapped to keyboard light) nothing happens. If I shine a light on the sensor, the keyboard light turns off but there is no output while running acpi_listen

  • What happens if you add acpi_osi=Linux to the command line arguments? Do things start to work? Alternatively, please try acpi_osi=Windows. – Kaz Wolfe Mar 25 '17 at 2:07
3
+250

Keyboard backlight

Any vendor

From Arch Linux wiki: You can control your computer keyboard backlight via the D-Bus interface. The benefits of using it are that no modification to device files is required and it is vendor agnostic.

Here is an example implementation in Python 3. Place the following script in /usr/local/bin/ and make it executable. You can then map your keyboard shortcuts to run /usr/local/bin/kb-light.py + and /usr/local/bin/kb-light.py - to increase and decrease your keyboard backlight level.

Here is python code for /usr/local/bin/kb-light.py:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-    
from sys import argv
import dbus


def kb_light_set(delta):
    bus = dbus.SystemBus()
    kbd_backlight_proxy = bus.get_object('org.freedesktop.UPower', '/org/freedesktop/UPower/KbdBacklight')
    kbd_backlight = dbus.Interface(kbd_backlight_proxy, 'org.freedesktop.UPower.KbdBacklight')

    current = kbd_backlight.GetBrightness()
    maximum = kbd_backlight.GetMaxBrightness()
    new = max(0, current + delta)

    if new >= 0 and new <= maximum:
        current = new
        kbd_backlight.SetBrightness(current)

    # Return current backlight level percentage
    return 100 * current / maximum

if __name__ == '__main__':
    if len(argv[1:]) == 1:
        if argv[1] == "--up" or argv[1] == "+":
            # ./kb-light.py (+|--up) to increment
            print(kb_light_set(1))
        elif argv[1] == "--down" or argv[1] == "-":
            # ./kb-light.py (-|--down) to decrement
            print(kb_light_set(-1))
        else:
            print("Unknown argument:", argv[1])
    else:
        print("Script takes exactly one argument.", len(argv[1:]), "arguments provided.")
| improve this answer | |
  • Caveat: Your system needs to support the backlight through drivers. While control is hardware-agnostic, it still must be supported. If OP can't control the backlight through the buttons, I doubt it's going to be supported through software (although I may be wrong). – Kaz Wolfe Mar 25 '17 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.