[Pm-utils] Basic powersave hooks

Stefan Seyfried seife at suse.de
Tue Jul 1 05:35:53 PDT 2008


Victor Lowther wrote:
> After getting annoyed at fedora's lack of support for laptop-mode, I
> coded up a rudimentary set of hooks to enable/disable laptop mode,
> perform the VM and FS tweaking needed to make laptop mode effective, and
> enable/disable write caching and hard drive spindown.
> 
> The hooks (available in the powersave-hooks branch of the main fd.o git
> repository[1]) are quite rudimentary and have hardcoded everything, but
> should make a nice starting point for further hacking.
> 
> Other useful hooks, tweaks/fixes/complete rewrites, etc. welcome!

I was actually in the same situation. I did, however, not want to reinvent the
wheel again, so i just packaged up laptop-mode-tools for openSUSE. I disabled
some of its features (cpu frequency control? Does not belong there! ;-) and
adopted it slightly, so that it can be called from a pm-utils hook like that:
(sources and patches are in the src.rpm at
http://download.opensuse.org/repositories/home:/seife:/Factory/openSUSE_11.0/src/laptop-mode-tools-1.41-4.1.src.rpm)
------
#!/bin/bash
#
# integrate laptop-mode into pm-utils hook infrastructure
. /usr/lib/pm-utils/functions
case "$1" in
        true)
                echo "** start laptop-mode"
                laptop_mode start
                ;;
        false)
                echo "** stop laptop-mode"
                laptop_mode stop
                ;;
        *)
                ;;
esac
-------

It will only do anything if it is enabled with "/etc/init.d/laptop-mode start"
so it can still be easily disabled with chkconfig and friends.

I think leveraging the existing tool and documentation is in this case more
efficient than implementing it again.

Have fun,

	Stefan
-- 
Stefan Seyfried
R&D Team Mobile Devices            |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out."

This footer brought to you by insane German lawmakers:
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


More information about the Pm-utils mailing list