Alrighty folks, I got fed up with the limited functionality of kpowersave and how very slow suspend was, so I went and hacked my own solution. This is a fairly long process requiring quite a few hacks because there isn't one good system as of yet. What this howto will hopefully achieve:
- suspend in under 5 seconds
- resume in under 6 seconds
- fix NetworkManager issues with not starting properly during suspend
- allow control over cpu frequency scaling (for instance, having it run performance mode when AC is plugged in, and drop to dynamic if running on battery)
- allow control over default brightness levels on ac/battery
- provide detailed information on battery life and (over time) battery health and performance statistics
If you just want to improve your suspend times, then you only need Part 1 of this guide.
Shall we, then?
Part 1 - Fixing Suspend
Run
- Code: Select all
sudo cp /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
/usr/lib/hal/scripts/linux/hal-system-power-suspend-linux.backup
This will backup your existing suspend sequence in case you want to go back to it.
Then to open the file we need for editing:
- Code: Select all
sudo mousepad /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
Replace the entire contents of the file with:
- Code: Select all
#!/bin/sh
if [ -x "/usr/sbin/pm-suspend" ] ; then
/bin/sync
/sbin/modprobe -r ath_pci
/sbin/modprobe -r wlan_scan_sta
/sbin/modprobe -r wlan_acl
/sbin/modprobe -r wlan_wep
/sbin/modprobe -r wlan_xauth
/sbin/modprobe -r wlan_ccmp
/sbin/modprobe -r wlan_tkip
/sbin/modprobe -r uvcvideo
/sbin/modprobe -r uhci_hcd
/usr/bin/pm-suspend
/sbin/modprobe ath_pci
/sbin/modprobe wlan_scan_sta
/sbin/modprobe wlan_acl
/sbin/modprobe wlan_wep
/sbin/modprobe wlan_xauth
/sbin/modprobe wlan_ccmp
/sbin/modprobe wlan_tkip
/sbin/modprobe uvcvideo
/sbin/modprobe uhci_hcd
/usr/local/bin/wlanconfig ath0 create wlandev wifi0 wlanmode sta
/sbin/ifconfig ath0 up
/sbin/modprobe coretemp
RET=$?
else
# TODO: add support
unsupported
fi
exit $RET
Step 2
To speed things up even more we need to get rid of some duplicate stuff. Run
- Code: Select all
sudo cp -r /usr/lib/pm-utils/sleep.d /usr/lib/pm-utils/sleep.d.backup
rm -rf /usr/lib/pm-utils/sleep.d/*
There, you should have poweroff in about under 5 seconds and about the same to resume. But depending on what other stuff you have on your system, mileage may vary!
Part 2 - Gnome Power Manager
Step 1 - Dependencies
Fix the gnome-menus dependency issue #3 as described by macles in this post: http://macles.blogspot.com/2008/08/depe ... e-one.html
Quote from the blog:
#3 gnome-menus
This depedency problem is triggered via f-spot or evolution, displaying the following error message.
file /usr/share/desktop-directories/Internet.directory from install of gnome-menus-2.20.3-1.fc8 conflicts with file from package xfdesktop-acer-lp-1522.no_spot.mcs_patched
file /usr/share/desktop-directories/Settings.directory from install of gnome-menus-2.20.3-1.fc8 conflicts with file from package xfdesktop-acer-lp-1522.no_spot.mcs_patched
It's fairly easy to fix. Just download gnome-menus and redhat-menus and force their installation. Then restore the original content of the conflicting files.
sudo yum install yum-utils
sudo yumdownloader gnome-menus redhat-menus
sudo rpm -U --force gnome*rpm redhat*rpm
cd /usr/share/desktop-directories
sudo sed -i.1 "s:applications-games:games.png:" Games.directory
sudo sed -i.1 "s:applications-internet:internet.png:" Internet.directory
sudo sed -i.1 "s:gnome-settings:setting-logo.png:" Settings.directory
Step 2 - Install gnome-power-manager
Then from a terminal, run
- Code: Select all
sudo yum install gnome-power-manager
It should download a bunch of gnome dependencies, like "gnome-panel" etc. let it.
Step 3 - Remove kpowersave and autostart gnome-power-manager
From a terminal, run
- Code: Select all
sudo cp /etc/rc.d/slim/nowait.sh /etc/rc.d/slim/nowait.sh.backup
sudo mousepad /etc/rc.d/slim/nowait.sh
The first line backs up the original file, the second line opens a window allowing us to edit the script.
Look for the following lines:
- Code: Select all
while true
do
kpid=
kpid=`pidof kpowersave`
if [ "X${kpid}" == "X" ];then
/usr/bin/kpowersave &
fi
if [ "X${kpid}" != "X" ];then
break
fi
sleep 3
done
Change all instances of "kpowersave" to "gnome-power-manager", like so:
- Code: Select all
while true
do
kpid=
kpid=`pidof gnome-power-manager`
if [ "X${kpid}" == "X" ];then
/usr/bin/gnome-power-manager &
fi
if [ "X${kpid}" != "X" ];then
break
fi
sleep 3
done
Save and close the file.
Step 4 - Configuration
You don't have to reboot for gnome-power-manager to take effect, simply run
- Code: Select all
sudo killall kpowersave
gnome-power-manager
And you should see a battery icon pop up next to your wifi in the taskbar.
Right clicking on the icon gives you a preferences window, they're all pretty self explanatory. But there are a lot more preferences that we can use that aren't available in that menu.
If we want to control cpu frequency scaling depending on if there is ac power or if we're running on battery there is one more step we need to do.
Again in a terminal,
- Code: Select all
sudo yum install gconf-editor
This app is a little like the windows registry editor, but for (mostly) gnome apps and not quite so complicated.
Once it's isntalled, you can run it from a terminal using
- Code: Select all
gconf-editor
Or press Alt+F2 and type in the above command. Find apps->gnome-power-manager->ui, find "cpufreq_show" and check the box. This will enable the option to configure cpu frequency settings in the right click, preferences menu of gnome-power manager.
There you're done!
You can read up about the other hidden power manager settings by clicking on the name of the setting and reading its long description at the bottom. If you left click on the icon you will get a menu to "suspend" and a clickable battery menu. Clicking on the battery gives you some statistics, the most useful being "battery health" as a percentage of the original capacity.
Right clicking and selecting power history gives you a power history.

