User Tools

Site Tools


foss:ubuntu:wikishelf:hal:feisty

Managing the LCD backlight of your Dell laptop

Introduction

This article will try to expose a way to use HAL to control your LCD backlight. The idea behind is to save energy (thus enhancing the battery life) by reducing the backlight intensity when the computer is idle.

Intended readership

This document is intended to end user who wants to have more control over their LCD backlight and who wants to increase the laptop battery life.

Applicability statement

This document applies to Ubuntu Desktop Edition 7.04. Other versions of this software or other linux distribution could apply, but have not been validated. The user must have access to administrative rights to perform the described actions.

In addition, the following requirements apply to this guide:

  • Package management system compatible with Debian or Ubuntu system (using dpkg and apt-get)
  • HAL version 0.5.9 or higher
  • libsmbios 0.13 or higher
  • A Dell laptop

Conventions

All user commands will be written in Courier New font, and will start with a '$' symbol that should not be reproduced when typing the commands. This symbol represents the SHELL prompt character. The commands will be given for a BASH syntax shell.

Concept

Ubuntu 7.04 has already HAL installed (in the back-ported repository) however without the libsmbios support built-in. Also, we need to manually back-port the libsmbios from Ubuntu Gutsy Gibbon.

Guide

Requirements

The following package are required for installation before proceeding, you will need to activate the Universe repository (see Ubuntu documentation for installing software):

build-essential libdbus-1-dev libdbus-glib-1-dev libvolume-id-dev libexpat-dev libxml2-dev libcppunit-dev doxygen graphviz

Download

The source code for libsmbios from Gutsy needs to be downloaded. If you follow the link, there is a section called “Download libsmbios” where 3 files are listed in a table. One should download them to his home directory. The home directory is the directory that bare the same name as the user in the “Save as” dialog window of Firefox, or that is called “Home Folder” in the Gnome menu called “Places”.

Instructions

libsmbios

First we create the DEB packages for libsmbios.

$ mkdir /tmp/build
$ cd /tmp/build
$ tar zxf ~/libsmbios_0.13.6.orig.tar.gz
$ cd libsmbios-0.13.6
$ gzip -cd ~/libsmbios_0.13.6-1.diff.gz | patch -Np1
$ mv ~/libsmbios_0.13.6-1.dsc .
$ chmod +x debian/rules
$ sudo dpkg-buildpackage

Then we install them:

$ cd ..
$ sudo dpkg -i libsmbios1_0.13.6-1_i386.deb libsmbios-bin_0.13.6-1_i386.deb libsmbios-dev_0.13.6-1_i386.deb libsmbiosxml1_0.13.6-1_i386.deb

HAL - Hardware Abstraction Layer

Once libsmbios is installed, HAL needs to be recompiled with the libsmbios support. The above libsmbios is required as the version shipped with Ubuntu 7.04 is too old.

The following lines will compile HAL. You have to activate the back-port repository and reload your repository sources (see the Ubuntu documentation on managing the software repositories). It is mandatory at this point to update your system to the latest packages before proceeding. Once done, follow these instructions:

$ cd /tmp/build
$ apt-get source hal
$ cd hal-0.5.9
$ ./configure --with-dell-backlight
$ make

Now that HAL is compiled, we will not install it over the current installation as it is not necessary. There is only one component in this package that is required to manipulate the Dell LCD backlight: it is an add-on to hald the HAL main daemon (a program that runs silently in the background). Installing this add-on is really simple and requires only two commands:

$ sudo cp ./hald/linux/addons/.libs/hald-addon-dell-backlight /usr/lib/hal/
$ sudo cp ./fdi/policy/10osvendor/10-dell-laptop-brightness.fdi /usr/share/hal/fdi/policy/10osvendor/

Loading the dcdbas Kernel driver

In order for libsmbios to work, a kernel driver (called module) is necessary to perform certain operations. Usually a call to the command line $ sudo modprobe dcdbas is enough. However, after each reboot, one would need to execute the command again. If one wants to make the change permanently, he would need to edit the file /etc/modules with his favourite text editor. As this requires administrative privileges, the user should execute the following command (this example uses gedit, which is the default graphical text editor in Ubuntu):

$ gksudo gedit /etc/modules

At the end of the file, one should add a new line containing only this:

dcdbas

One should save the file and exit the text editor.

Now your system is updated and you can restart your computer for the changes to take effect.

Saving more power with HAL and the backlight control

Gnome configuration editorNow, let's configure Gnome Power Manager (GPM) to take advantage of the backlight control capabilities available in HAL. At this point, the package gconf2 is required (see Ubuntu documentation for installing software) which will install Gnome Configuration Editor. Once done, one should go in the Gnome menu “Applications” → “System tools” → “Configuration editor”. This application looks like a file explorer and one should go under /apps/gnome-power-manager using the left pane (see the figure on the right side).

Now there are three parameters that are of interest:

  • ac_dim_on_idle: tells GPM to dim the screen or not when the computer is plugged using the AC adaptor
  • battery_dim_on_idle: tells GPM to dim the screen or not when using the battery
  • laptop_panel_dim_brightness: tells GPM the percentage of brightness to be used when dimming the screen

The two first parameters should be activated (the box should be checked). As for the latest one, it corresponds to the percentage of brightness Gnome Power Manager will use when it will dim the screen. The default (30) should be enough.

The last thing to set-up is when the “idle” state will be triggered. Under Linux, the idle event triggers usually the screen saver. In the screen saver preferences, one can specify when the system is considered idle, thus when the system activates the screen saver.
Ironically, when you are running on battery (and even on power supply), it is recommended to disable the screen saver to save energy! Yes, screen savers can consume a lot of energy for the animation and by consequence they can reduce your expected battery life. It is safe to deactivate them (especially with modern LCD screen). Instead using the backlight feature and dimming the screen is a more efficient approach to save energy.

Gnome screensaver preferencesIn the Gnome menu “System” → “Preferences” → “Screensaver”, one should deselect “Activate screensaver when computer is idle” and set the “Regard the computer as idle after:” to a value that best suit him. I personally use 1 minute, but one can increase this value (see figure on the right side). When 1 minute is selected, it means that Gnome Power Manager will dim the screen to save battery power after one minute of inactivity (no user input).

Now, Gnome Power Manager is set-up to dim the screen when the computer is idle.

foss/ubuntu/wikishelf/hal/feisty.txt · Last modified: 2013/09/11 14:18 (external edit)