How do I set zero brightness on laptops that have a nonzero minimum brightness on the brightness control?
The solution should work regardless of X. I.e. it should also work in the virtual terminals.
backlightbrightnesslinux
How do I set zero brightness on laptops that have a nonzero minimum brightness on the brightness control?
The solution should work regardless of X. I.e. it should also work in the virtual terminals.
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
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.
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.
There can be numerous reason why this doesn't work, and they are all to complicated to ask in a comment to the question, so I'll leave this as a resource here - and if none of these work feel free to comment rather than down-voting and I'll remove it (or leave for others who end up here with the same problem but different causes).
The first thing you can try is adding one of these kernel parameters:
acpi_osi=Linux
acpi_osi="!Windows 2012"
acpi_osi=
This is a pretty common issue where the backlight stops working after a suspend (I know this isn't directly related, but might be worth mentioning).
Another issue might be that you're lacking sufficient permission to actually modify the brightness (again, probably not related to OP since the error message is usually different and OP has already tried it). If that's the case, modify the udev-rules by changing/adding this to /etc/udev/rules.d/backlight.rules
:
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
Another, also common issue, is when used in conjunction with multiple graphic cards or hybrid graphics (like the Optimus project).
If so, you can try to add one of the following kernel parameters:
acpi_backlight=video
acpi_backlight=vendor
acpi_backlight=native
acpi_backlight=none # <-- Mainly for AMD/ATI drivers
Finally, what OP might be here for:
Change /etc/X11/xorg.conf.d/20-intel.conf
to reflect:
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "Backlight" "intel_backlight"
EndSection
Odds are xrandr or xbacklight have just got a faulty mapping against /sys/class/backlight/<path>
. Thus, manually setting it to intel_backlight
might solve your issue. All that might be wrong is the Identifier, judging by the question. If it still doesn't work, verify and make sure that the Device-config is actually the one in use, because it really sounds like a mapping issue between xrandr/xbacklight and the path where it thinks it'll find the backlight-directory.
Any of these might give you a clue or hint as to which driver and config is being used:
lspci | grep VGA
lsmod | grep "kms\|drm"
find /dev -group video
cat /proc/cmdline
find /etc/modprobe.d/
cat /etc/modprobe.d/*kms*
glxinfo | grep -i "vendor\|rendering"
grep LoadModule /var/log/Xorg.0.log
egrep -i " connected|card detect|primary dev|Setting driver" /var/log/Xorg.0.log
udevadm info -a -p /sys/class/backlight/intel_backlight/
I hope it's as simple as this; if it's not, again, I'd be happy to change my answer or delete it all together. Just sharing some knowledge gathered while struggling with the same thing. bugs.debian.org issue
Oh, and the kernel parameter nomodeset
tends to interfere with backlight settings. I don't know why. But if whoever ends up here uses it, try to remove that and see if at least the backlight kicks in again.
Best Answer
From X Windows
From X Windows you can use the application
xbacklight
to get and set the percent brightness for your screen.Example
current level
set to 75%
set back to 100%
From the console
To achieve something similar for a virtual terminal you'll likely need to interact with the ACPI settings via the
/sys
filesystem.Example
dims it
full brightness
You'll have to play with this one, the range of brightnesses can be from 0-9 or 0-15, I believe it ultimately depends on your laptop.
None of this works?
If neither of these 2 options suites your needs take a look at the ArchLinux Wiki's topic titled: Backlight. That article contains every method I've ever seen employed to achieve this!
References