Cutting power costs with KPowersave

Power Saver


KPowersave gives KDE users a single easy interface for configuring power management settings.

By Frank Wieduwilt

KTools

In this column we present tools, month by month, which have proven to be especially useful when working under KDE, solve a problem which otherwise is deliberately ignored, or are just some of the nicer things in life, which - once discovered - you would not want to do without.

Modern hardware comes with any number of power-saving options. KPowersave [1] provides a simple interface for managing these power options in Linux.

Useful Helpers

KPowersave requires an up-to-date KDE version. You'll also need a few helper applications. The Hardware Abstraction Layer (HAL) [2] facilitates access to peripherals. The version on your machine must be 0.5.4 or later. D-Bus, a technology that programs use to communicate on the X Window System [3], should be version 0.33 or newer, and you also need Powersave [4] 0.10.15 or newer.

If you don't have the current OpenSuse or ALT Linux distribution, you will need to build both KPowersave and the helper applications from source.

Start by getting D-Bus onto your disk. If a visit to [3] does not give you a package for your distribution, you can build the source code from the same site. To do so, download the dbus-0.50.tar.gz archive, and give the tar -xzvf dbus-0.50.tar.gz command to unpack.

After you have unpacked the D-Bus source files, change to the new dbus-0.50 directory, type ./configure to create a Makefile, and build the program by entering make. Complete the process by running su -c "make install" and entering the root password. This step installs D-Bus where you need it in the filesystem tree.

The steps for installing HAL are similar. For Powersave, enter autoreconf -fi to create a Makefile, then go on to follow standard procedure to build and install.

Finally, install KPowersave itself. The source code archive is available from the hompage at [1]. Unpack the source code, and change to the new kpowersave-0.5 directory. When you get there, type make -f admin/Makfile.common cvs to create templates for the makefiles. The Configure script then creates the makefiles themselves. Finally, enter make and make install to build and install the program.

Traps

KPowersave and Powersave (which comes with the KPowersave distribution) both proved fairly intractable during the install and in our lab. We were unable to compile Powersave on Mandriva 10.2 and Kubuntu 5.04. On Suse 9.3, the machine failed to wake up again after switching to sleep mode. In fact, we had no alternative but to reset the machine, which is something one would normally want to avoid. In contrast to this, there were no problems whatsoever on OpenSuse 10.0; everything worked as expected.

To launch KPowersave, type kpowersave in a console window, or select the program from the K menu. After the launch, KPowersave disappears into the system tray, showing you a battery icon if your laptop is running on battery power and a plug if you are running on external power. You can right click the icon to pop up a menu with program controls.

Clicking on Set CPU Frequency Policy gives you a choice between performance, dynamic response to the current load, and power saving. The Set active scheme item lets you enable pre-configured policies for specific scenarios in which you will be using the PC.

The Performance scheme reduces power saving options to a minimum. Acoustic reduces the PC's noise level by entering power saving mode as soon as possible. The Presentation scheme stops the screen switching off, despite a lack of keyboard and mouse input.

Finally Powersave reduces the CPU speed and shortens the intervals before the PC enters suspend mode. To send the computer to Suspend to RAM or Suspend to Disk mode, just click on the matching KPowersave menu item.

Tuning

Besides these useful settings, the program also gives you the ability to define a number of parameters for a user-specific configuration. Again, you can access the dialog via the context menu. Note that the settings you apply in KPowersave will override settings in other programs, so be careful.

The first page of the dialog (Figure 1) lets you modify the schemes KPowersave shows you when you right click the icon in the systray (Figure 2). You can set up the behavior of the screensaver, DPMS, and auto-suspend individually for each scheme.

Figure 1: Configuring KPowersave schemes.

Figure 2: Choose the scheme, and configure other settings such as the CPU Frequency Policy, through a handy context menu.

You also have the option of switching off the screensaver and entering the sleep, standby, and power off intervals for KPowersave. Use Autosuspend to specify the inactivity interval before the program puts the computer in suspend mode.

The second tab in the configuration dialog gives you settings for configuring the program's boot time behavior and for locking the screen. You can specify whether the system should lock the screen when you close the lid. In this case, you need to enter a password to continue when you open the lid. The Lock screen with: list lets you specify which program KPowersave will use to lock the screen.

The Edit general blacklist item takes you to a dialog where you can specify programs that prevent your machine from entering suspend mode. The tool offers you a list of programs, including TV programs, CD rippers, and presentation tools. You can add your own non-interruptible applications to the list.

The Sound settings button takes you to a dialog where you can assign sounds to events, such as low battery power.

Figure 3: The Autostart option launches KPowersave automatically on login.

Conclusions

The program left me in some doubt. On OpenSuse, KPowersave lived up to its promise of making it easier for users to set power saving options by assigning them to a single button. On older distributions, however, building the application and the helpers, or just running the program, proved difficult.

All in all, the software is heading in the right direction. Linux really does give users too many power saving options. Besides KPowersave, there is also a Yast module, a WindowMaker application, and a Gkrellm applet. The good news is that, whatever distribution you use, you are bound to find a power saving tool somewhere.

INFO
[1] KPowersave: http://freshmeat.net/projects/kpowersave.
[2] HAL: http://freedesktop.org/~david/dist/
[3] Dbus: http://hal.freedesktop.org/wiki/Software_2fdbus
[4] Powersave: http://sourceforge.net/projects/powersave/