I bought a Dell Inspiron laptop recently which came with Ubuntu 14.04 preinstalled. Something I noticed with the factory Ubuntu 14.04 image was that some of the settings were tweaked to work better with the laptop. One fine example was that the laptop display would automatically dim when I switched to laptop battery from the power supply. It would again go back to full brightness once I connected the adapter back.
I needed to upgrade the system to 16.04 which is the latest LTS version. I instead chose to do clean install with a standard Ubuntu 16.04.1 image. The installation was very smooth and almost everything worked out of the box. Everything except the automatic dim feature. Which was something I really liked because it did save some battery power. Anyway I looked up on the internet and I found something very useful. I did some manual hack and brought back the exact feature. Here’s what I did:
- Install laptop-mode-tools: Laptop-mode-tools is a package available in the standard Ubuntu repository which enables a Linux kernel feature that saves considerable battery power of a laptop. It can be installed from Terminal with the below command or from Synaptic or any other package manager.
sudo apt-get install laptop-mode-tools
Laptop-mode-tools also has a very premitive gui where a module can be checked/unchecked to enable/disable power management for a specific section of your system.
- Enable and set the brightness settings in laptop-mode-tools: The brightness management module is disabled in laptop-mode-tools by default. I needed to enable it and set some of the values related to settings. The brightness settings is stored in /etc/laptop-mode/conf.d/lcd-brightness.conf file. The settings in this file vary depending upon laptop hardware and the most confusing task is to find the BRIGHTNESS_OUTPUT file. The developers do mention a few tricks to find the file for your system in the config file itself.
- If your system has the file “/proc/acpi/video/VID/LCD/brightness” (VID may be VID1 or similar), use this file as BRIGHTNESS_OUTPUT.
- If you have a file /sys/class/backlight/…/brightness, then you can use that file as BRIGHTNESS_OUTPUT.
If the file is found using any of the above two ways (in my case, it was “/sys/class/backlight/intel_backlight/brightness”), then the process is pretty straightforward from there. The value inside the BRIGHTNESS_OUPUT file is the max value for brightness. Anything between 0 and the max value can be chosen as the min value. I had to update the below values in the /etc/laptop-mode/conf.d/lcd-brightness.conf file (opened with root priviledge):
CONTROL_BRIGHTNESS=1 BATT_BRIGHTNESS_COMMAND="echo <min-value>" LM_AC_BRIGHTNESS_COMMAND="echo <max-value>" NOLM_AC_BRIGHTNESS_COMMAND="echo <max-value>" BRIGHTNESS_OUTPUT="/sys/class/backlight/intel_backlight/brightness"
<min-value> and <max-value> need to be updated with the chosen min and max brightness value where as /sys/class/backlight/intel_backlight/brightness needs to be changed with the actual BRIGHTNESS_VALUE found.
In case of Toshiba laptops, the author of the tool says to use the command “toshset” with the -lcd or -inten command. Read the toshset(1) manual page for more information on the parameters for this command. If you use this command, set BRIGHTNESS_OUTPUT to “/dev/null”.
When everything is done, I unplugged the AC power to check if it was working and to my surprise, it really worked! I hope this helps. If you use any other method, I would be glad to learn about it.