1#!/bin/sh - 2# 3# $NetBSD: acadapter,v 1.3 2008/08/22 11:18:21 pgoyette Exp $ 4# 5# Generic script for acadapter events. 6# 7# Arguments passed by powerd(8): 8# 9# device event 10 11case "${2}" in 12pressed) 13 logger -p info "${0}: Full performance mode" >&1 14 # The following turns up brightness on a Sony Vaio laptop 15 /sbin/sysctl -w hw.sony0.brt=8 >/dev/null 2>&1 16 # Enable full performance mode for speedstep CPUs 17 /sbin/sysctl -w machdep.speedstep_state=1 2>&1 18 # Disable power saving mode on all network interfaces 19 for intf in $(/sbin/ifconfig -l); do 20 /sbin/ifconfig $intf -powersave >/dev/null 2>&1 21 done 22 23 # 24 # If you want to keep your hard disk idle while running on 25 # battery, the following commands will help. 26 # 27 28 # Disk idle timeouts 29 #/sbin/atactl wd0 setidle 300 30 #/sbin/atactl wd0 setstandby 600 31 # Make sure syslogd is running 32 #pkill syslogd 33 #/etc/rc.d/syslogd start 34 # Startup cron daemon when running on power 35 #/etc/rc.d/cron start 36 37 # All finished 38 exit 0 39 ;; 40 41released) 42 logger -p info "${0}: Power saving mode" >&1 43 # The following turns down brightness on a Sony Vaio laptop 44 /sbin/sysctl -w hw.sony0.brt=0 >/dev/null 2>&1 45 # Enable power saving mode for speedstep CPUs 46 /sbin/sysctl -w machdep.speedstep_state=0 >/dev/null 2>&1 47 48 # Enable power saving mode on all network interfaces 49 for intf in $(/sbin/ifconfig -l); do 50 /sbin/ifconfig $intf powersave >/dev/null 2>&1 51 done 52 53 # 54 # When running on battery, we want to keep the disk idle for as long 55 # as possible. Unfortunately, things like cron and syslog make this 56 # very difficult. If you can live without cron or persistent logging, 57 # you can use the commands below to disable cron and syslogd. 58 # 59 # If you still want to see syslog messages, you can create a custom 60 # /etc/syslog.conf.battery that writes messages to /dev/console or 61 # possibly a free wsdisplay screen. 62 # 63 64 # Disk idle timeouts 65 #/sbin/atactl wd0 setidle 30 66 #/sbin/atactl wd0 setstandby 120 67 68 # Stop the cron daemon 69 #/etc/rc.d/cron stop 70 71 # Restart syslogd using a diskless configuration 72 #pkill syslogd 73 #/usr/sbin/syslogd -s -f /etc/syslog.conf.battery 74 75 # All finished 76 exit 0 77 ;; 78 79*) 80 logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 81 exit 1 82 ;; 83esac 84