Whirliwig’s Weblog

Just another WordPress.com weblog

MM10 Debian Power Management Continued

leave a comment »

After getting suspend2 and hibernate working from the command line, the way to integrate these sleep/hibernate methods into gnome-power-manager world is to change the underlying HAL query scripts that gnome-power-manager uses.HAL abstracts hardware details from upper layers. That means:

  1. It allows querying of a ‘virtual hardware’ machine so that upper-layers don’t need to worry so much about adapting to each and every hardware variation
  2. it provides ‘actions’ on the ‘virtual hardware’ via scripts in /usr/lib/hal/scripts

gnome-power-manager uses these HAL scripts to poke your machine into doing the right thing.HAL is SOOOOOO concerned with abstraction, that it also seems designed to abstract away the fact we’re using linux…so it has sub-directories in /usr/lib/hal/scripts for each OS.Here, we’re interested in /usr/lib/hal/scripts/linux.And, we’re particularly interested in the HAL actions for power management:hal-system-power-hibernate-linuxhal-system-power-suspend-linuxetc…For whatever reason, my default scripts only support actually doing the power management (in a concrete sense) via pm-tools…an alternative to hibernate. So, I added a few bits to support hibernate as well.Note, the scripts as they are are mostly about setting up params to pass to pm-tools to handle ‘quirks’ of hardware. Hibernate handles quirks itself, so we don’t need to use all of the quirk code here. Just call hibernate-ram or hibernate-disk or whatever…E.g., hal-system-power-suspend-linux will end up with a section as so:

...  # We support hibernate-ram and pm-utils
if [ -x "/usr/local/sbin/hibernate-ram" ] ; then
# All Quirk handling delegated to hibernate script
/usr/local/sbin/hibernate-ram
RET=$?
elif [ -x "/usr/sbin/pm-suspend" ] ; then
/usr/sbin/pm-suspend $QUIRKS
RET=$?
else
# TODO: add support
unsupported
fi ... 

 

About these ads

Written by whirliwig

March 16, 2008 at 7:28 pm

Posted in Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: