/etc/power/pwrctl-local for an iBook 2.2 (cpufreq adjustement)
Hello,
For those that would find it useful, here is the /etc/power/pwrctl-local
script (don't forget to make it executable, "chmod 755") I'm using on my
debian iBook 2.2:
- use powersave mode (reduced cpu frequency) on battery, performance
mode on ac
- set fblevel off and do filesystem sync when going into sleep
For more info on cpufreq adjustement, look at Documentation/cpufreq in
kernel source tree.
I hope it will help others,
Best regards,
d.
#!/bin/bash
# -----------------------------------------------------------------------------
# $Id: pwrctl-local,v 1.1.1.1 2001/12/07 11:31:48 sleemburg Exp $
#
# This script is invoked by pwrctl to configure the system for a
# given power level. The desired level is indicated by the first
# argument, which can have the following values:
#
# minimum = minimum power
# medium = medium power
# maximum = full power
# sleep = prepare for sleep
# wakeup = system woke up after a sleep
# warning = low battery condition detected, issue a warning to users
#
# the second argument gives the current power source, and can take the
# following values:
#
# ac
# battery
#
#
# This script can be invoked by pwrctl when it is named /etc/power/pwrctl-local
# and is executable. Pwrctl is called by pmud on a power event. If this
# script returns the value 1, then pwrctl will skip it's main body
#
# Example usage: use ifdown -a on sleep (and ifup -a on wakeup) to
# automagically renew DHCP leases. Similar use of iwconfig down/up might be
# required for Wavelan users with older versions of the kernel.
#
# -----------------------------------------------------------------------------
# $Log: pwrctl-local,v $
# Revision 1.1.1.1 2001/12/07 11:31:48 sleemburg
# Initial CVS import of the unreleased pmud-0.8 to apmud (new project name
# because of a name clash at sourceforge.net).
#
# Revision 1.2 2000/03/25 21:26:37 stephan
# pmud-0.5 changes
#
# Revision 1.1 2000/03/09 13:02:18 stephan
# Initial revision
#
# -----------------------------------------------------------------------------
logger=/usr/bin/logger
# -----------------------------------------------------------------------------
# main
# -----------------------------------------------------------------------------
case "$1" in
minimum)
$logger -p daemon.info -t pwrctl-local "minimum power $2"
case "$2" in
ac)
echo -n "0%50%100%performance" > /proc/cpufreq
;;
*)
echo -n "0%50%100%powersave" > /proc/cpufreq
;;
esac
;;
medium)
$logger -p daemon.info -t pwrctl-local "medium power $2"
case "$2" in
ac)
echo -n "0%50%100%performance" > /proc/cpufreq
;;
*)
echo -n "0%50%100%powersave" > /proc/cpufreq
;;
esac
;;
maximum)
$logger -p daemon.info -t pwrctl-local "maximum power $2"
case "$2" in
ac)
echo -n "0%50%100%performance" > /proc/cpufreq
;;
*)
echo -n "0%50%100%powersave" > /proc/cpufreq
;;
esac
$logger -p daemon.info -t pwrctl-local "skipping pwrctl-main"
exit 1
;;
warning)
/usr/bin/wall "Low battery, system going down any minute now"
;;
lid-closed)
$logger -p daemon.info -t pwrctl-local "lid-closed $2"
;;
lid-opened)
$logger -p daemon.info -t pwrctl-local "lid-opened $2"
;;
sleep)
$logger -p daemon.info -t pwrctl-local "sleep $2"
sync;sync;sync
fblevel off
;;
wakeup)
$logger -p daemon.info -t pwrctl-local "sleep $2"
case "$2" in
ac)
echo -n "0%50%100%performance" > /proc/cpufreq
;;
*)
echo -n "0%50%100%powersave" > /proc/cpufreq
;;
esac
fblevel on
;;
*)
$logger -p daemon.error -t pwrctl-local "invalid arg $1 $2"
exit 2
;;
esac
exit 0
--
david.mentre@wanadoo.fr
Reply to: