5

Everything about the backlight settings and controls work for me except:

Backlight resets to max. on every reboot/boot. The backlight minimum goes on to complete black screen, instead of the minimum brightness setting elsewhere. NB> I see that 1. above is answered on a lot of places with different answers, so I am actually looking for someone or somplace where I can read and understand how it all works.

I have 2 different backlight folders in my laptop and many conf files to edit. So need to understand what on those files impacts what on the sytem.

1 Answer 1

4

At the heart of backlighting is this Linux Kernel parameter that's exposed to you through here under /sys. You can manipulate it by setting the value to something between 1 and 15. For example:

$ echo 5 | sudo tee /sys/class/backlight/acpi_video0/brightness

Set's the brightness to 5. Manipulating this Kernel parameter is abstracted away so that when you're changing the value with your keyboard or a desktop applet you're manipulating it through D-Bus and HAL.

D-Bus is allowing you to manipulate this structure, org.freedesktop.Hal.Device.KeyboardBacklight, and HAL is allowing the privilege to do so. You can see this on my Fedora 14 system like this:

$ grep -i backlight /etc/dbus-1/system.d/*
/etc/dbus-1/system.d/hal.conf:         send_interface="org.freedesktop.Hal.Device.KeyboardBacklight"/>
/etc/dbus-1/system.d/hal.conf:         send_interface="org.freedesktop.Hal.Device.KeyboardBacklight"/>

In the file hal.conf:

  <!-- Only allow users at the local console to manipulate devices -->
  <policy at_console="true">
  ...
      <allow send_destination="org.freedesktop.Hal"
           send_interface="org.freedesktop.Hal.Device.KeyboardBacklight"/>

You can query the current value, through D-Bus like so:

$ dbus-send \
     --print-reply \
     --system \
     --dest=org.freedesktop.Hal  \
     /org/freedesktop/Hal/devices/computer_backlight \
     org.freedesktop.Hal.Device.LaptopPanel.GetBrightness | \
     tail -1 | \
     awk '{print $2}'

Which returns the value:

15

You can also manipulate it from the command line like so, (the bit int32:10 below is setting brightness to "10"):

$ dbus-send \
     --print-reply \
     --system \
     --dest=org.freedesktop.Hal  \
     /org/freedesktop/Hal/devices/computer_backlight \
     org.freedesktop.Hal.Device.LaptopPanel.SetBrightness \
     int32:10 #2&>1 > /dev/null

You can see that we changed the brightness:

$ cat /sys/class/backlight/acpi_video0/brightness
10

So how do I fix this?

One idea would be to save the current brightness out to a file prior to either a shutdown and/or reboot and then add to your startup (perhaps ~/.xinitrc) the dbus-send ... command above adding in the brightness value you previously saved out to the file.

Why do I have multiple files under /sys/class/backlight?

I came across this Q&A on askubuntu.com titled: Why there are two brightness control file (/sys/class/) in my system. In the answer to this there was this comment:

If the system starts with the kernel parameter acpi_backlight=vendor, the item acpi_video0 is replaced by the item intel, but then the Fn-Keys can not change the value of this item.

I also came across this documentation for the Kernel, titled: Kernel Parameters. In this doc the following aCPI options are mentioned:

acpi_backlight= [HW,ACPI]
        acpi_backlight=vendor
        acpi_backlight=video
        If set to vendor, prefer vendor specific driver
        (e.g. thinkpad_acpi, sony_acpi, etc.) instead
        of the ACPI video.ko driver.

I think the intel_backlight referenced in /sys/class/backlight is part of the backlighting for the video card drivers provided for Intel graphics cards.

References

5
  • Thank you. I do understand the part for acpi backlight...that's the kind of info I am looking for. But any idea why I also have another folder /sys/class/backlight/intel_backlight
    – charlie
    Jul 22, 2013 at 23:17
  • @charlie - some additional info, not sure if it's what you wnat, lmk.
    – slm
    Jul 23, 2013 at 0:36
  • 3
    Please take note that HAL has been deprecated. Now xrandr --set backlight or xbacklight is the official "abstracted" way (provided your gpu driver supports it)
    – mirh
    Jun 23, 2019 at 13:57
  • This sudo echo 5 > /sys/class/backlight/acpi_video0/brightness will not work, you need to use echo 5 | sudo tee /sys/class/backlight/acpi_video0/brightness Apr 15, 2020 at 12:23
  • 1
    @DaniëlW.Crompton - ty I'll fix that, nice catch
    – slm
    Apr 15, 2020 at 15:22

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.