Work laptop from Schibsted S?k AS.
Running Gentoo GNU/Linux.
Was remarkably easy to install. Thanks to good linux competence from work peers with the same model!
Centrino wireless adaptor uses ipw2200, with fantastic connectivity.
Using ATI prop. drivers to run "Big Desktop" when in the office.
Power management is followed almost to the word from
http://www.gentoo.org/doc/en/power-management-guide.xml , an *excellent* guide from Dennis Nienh?ser. Except I have four runlevels instead of just the two:
- default (battery, no network)
- batterynetwork (battery, network)
- power (power, no network)
- powernetwork (power, network)
So my /etc/acpi/actions/pmg_switch_runlevel.sh instead looks like:
#!/bin/bash# BEGIN configuration
RUNLEVEL_AC="power"
RUNLEVEL_AC_ONLINE="powernetwork"
RUNLEVEL_BATTERY="default"
RUNLEVEL_BATTERY_ONLINE="batterynetwork"
# END configuration
# Pre-conditions:
# - all runlevels exist
#if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]
then
logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."
exit 1
fiif [ ! -d "/etc/runlevels/${RUNLEVEL_AC_ONLINE}" ]
then
logger "${0}: Runlevel ${RUNLEVEL_AC_ONLINE} does not exist. Aborting."
exit 1
fiif [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]
then
logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."
exit 1
fiif [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY_ONLINE}" ]
then
logger "${0}: Runlevel ${RUNLEVEL_BATTERY_ONLINE} does not exist. Aborting."
exit 1
filogger "Checking power and network status against current runlevel"if on_ac_power
then # Power plugged in.
if ifconfig | grep -A 2 eth | grep --silent "inet addr" ; then # Power plugged in. Network connected. --> RUNLEVEL_AC_ONLINE
if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC_ONLINE}" ]]
then
logger "Switching to ${RUNLEVEL_AC_ONLINE} runlevel"
/sbin/rc ${RUNLEVEL_AC_ONLINE}
fi else # Power plugged in. No network. --> RUNLEVEL_AC
if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]
then
logger "Switching to ${RUNLEVEL_AC} runlevel"
/sbin/rc ${RUNLEVEL_AC}
fi fielse # Running on battery.
if ifconfig | grep -A 2 eth | grep --silent "inet addr" ; then # Running on battery. Network connected. --> RUNLEVEL_BATTERY_ONLINE
if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY_ONLINE}" ]]
then
logger "Switching to ${RUNLEVEL_BATTERY_ONLINE} runlevel"
/sbin/rc ${RUNLEVEL_BATTERY_ONLINE}
fi else # Running on battery. No network. --> RUNLEVEL_BATTERY
if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]
then
logger "Switching to ${RUNLEVEL_BATTERY} runlevel"
/sbin/rc ${RUNLEVEL_BATTERY}
fi fifiThis gives me even finer control on my services, instead of just letting them fail. Especially since I've found there's a bigger difference in which services are running between network and no-network then there is between power and battery! This approach saves alot of time at startup.