#!/bin/sh ## syd:/etc/acpi/actions/ac_adapter.sh # # Sony Vaio Power Management for ACPI event ac_adapter # # Jason R. Blevins # # $Id: ac_adapter.sh,v 1.7 2005/01/02 22:23:20 jrblevin Exp $ # Revision History: # # 02-Jan-05 17:21 Jason R. Blevins # * Removed HDD power management since it is included in # laptop_mode # # 30-Dec-04 19:21 Jason R. Blevins # * Removed references to laptop_mode since Debian now includes # it and optionally starts it at boot time # * spicctrl is in /usr/bin now # * swap is /dev/hda6 # # 27-May-04 15:56:22 Jason R. Blevins # * Always keep printer modules loaded now # * Control atd, crond, anacron, smartd, pcmcia # # 09-May-04 16:12:55 Jason R. Blevins # * Initial version, based on code by Erik Andresen from # http://defiant.homedns.org/~erik/Linux-vaio.txt # AC Adapter Status AC_ADAPTER=`cat /proc/acpi/ac_adapter/ACAD/state | awk '{print $2}'` # Program and configuration locations SPICCTRL=/usr/bin/spicctrl # System parameters DC_BRIGHTNESS=50 AC_BRIGHTNESS=255 if [ $1 ]; then arg1=$1 else arg1="None" fi # Status if [ $arg1 == "status" ]; then echo -e "AC Adapter:\t$AC_ADAPTER" echo -e "CPU Throttling:\t`cat $CPU_THROTTLING | grep "*" | awk '{print $2}'`" echo -e "LCD Brightness:\t`$SPICCTRL -B`" exit 0 fi # Power Management case $AC_ADAPTER in on-line) echo "AC-Adapter is present" # Display setterm -blank 0 $SPICCTRL -b $AC_BRIGHTNESS # Load optional modules modprobe -q parport_pc modprobe -q lp modprobe -q parport # Initialize optional services /etc/init.d/sysklogd start /etc/init.d/pcmcia start /etc/init.d/atd start /etc/init.d/cron start echo ;; off-line) echo "Using Batter Power" # Reset Display Standby and Brightness setterm -blank 3 $SPICCTRL -b $DC_BRIGHTNESS # Unloading optional services if [ $arg1 != "start" ]; then # _not_ running from init /etc/init.d/sysklogd stop /etc/init.d/pcmcia stop /etc/init.d/atd stop /etc/init.d/cron stop fi # Unload optional modules modprobe -q -r parport_pc modprobe -q -r lp modprobe -q -r parport ;; *) echo "Unknown Action" exit 1 esac exit 0