CLI Quickies (I): Let there be Backlight
You can adjust the brightness of your laptop’s screen from the command line to make sure it is working properly. Keep reading to find out how.
Say the brightness is all out of whack or your screen simply doesn’t come on and you can’t see a thing. To rule out issues with your desktop environment, or hardware and driver problems, you can try and change the brightness of the backlight from the command line.
Conventions used in this guide
Throughout our command line tutorials, we use $
to indicate you can run the command shown as a regular user, and #
to indicate you must run the instruction as superuser/root or using sudo
.
When we show both the instruction and its output, what you have to actually type is shown in bold
.
As it is always useful to have a way into your computer from another machine to see what you’re doing (remember: your screen doesn’t light up), I’m going to assume you have an SSH server running and you know how to ssh into your laptop.
Another option is to hook up an external monitor to your extra VGA, HDMI, or DVI port (you’ve got one of those, right?) and hit [Ctrl] + [Alt] + [F1]
. On most Linuxes this key combination will take you to a text only terminal and the output will by unified. This means that whatever is being shown (but you can’t see) on the laptop monitor, will show up on the external monitor.
Whichever approach you decide to use, become root (su
or sudo su
) and look for the directory that contains a file called brightness under the /sys/class/backlight directory. In my case that directory is:
/sys/class/backlight/intel_backlight/
If the hardware on your laptop is different, the path may be somewhat different also.
This directory, apart from brightness, holds some other quite interesting files. Look into actual_brightness and you’ll see the current level of your backlight:
# cat /sys/class/backlight/intel_backlight/actual_brightness 1000
If the number is very low or 0
, there’s your problem right there. To know what “very low” means for your screen’s backlight, have a look in the max_brightness file:
# cat /sys/class/backlight/intel_backlight/max_brightness 4882
In this case, if the contents of actual_brightness is 0
the backlight will be off, and if it is 4882
it will be at its maximum brightness — at least for the hardware shown above: a different laptop showed 255000 as its max_brightness. The figure varies from machine to machine.
To set the brightness of your screen just push a number into the brightness file using echo:
# echo 2000 > /sys/class/backlight/intel_backlight/brightness
Your LCD backlight brightness should change intensity.
If you can’t get the backlight to respond, don’t panic yet! It doesn’t necessarily mean your screen is broken. It may just mean that the driver you need hasn’t loaded or is not installed.
Look up the hardware specifications for your screen and your video card using the lspci tool:
# lspci | grep -i vga 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 630M] (rev ff)
It’s quite usual for systems to have two video cards nowadays, but I’m pretty sure that what we’re looking for is the Intel. You can see if a driver is loaded for this card by using
# lspci -s 00:02.0 -v 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller]) DeviceName: Onboard IGD Subsystem: ASUSTeK Computer Inc. Device 2113 Flags: bus master, fast devsel, latency 0, IRQ 26 Memory at dc400000 (64-bit, non-prefetchable) [size=4M] Memory at b0000000 (64-bit, prefetchable) [size=256M] I/O ports at e000 [size=64] Expansion ROM at [disabled] Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit- Capabilities: [d0] Power Management version 2 Capabilities: [a4] PCI Advanced Features Kernel driver in use: i915 Kernel modules: i915
See those two lines at the end? It is telling you that a driver is loaded. If those lines were absent you would know the problem was related to the driver. Note that the name of the driver will change depending on your hardware.
If despite having a loaded driver, your screen still doesn’t respond… Well, this would be a worse case scenario and time to figure out how to change the backlight on your laptop.
Cover Image: Planet Eclipse by Efi21 on Morguefile.com