Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / etc / powerd / scripts / acadapter
blobb44dbe2eb8f730f8b451c1d10593b92a76710ed5
1 #!/bin/sh -
3 # $NetBSD: acadapter,v 1.2 2006/09/27 01:41:45 jnemeth Exp $
5 # Generic script for acadapter events.
7 # Arguments passed by powerd(8):
9 # device event
11 case "${2}" in
12 pressed)
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
24 # If you want to keep your hard disk idle while running on
25 # battery, the following commands will help.
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
37 # All finished
38 exit 0
41 released)
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
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
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.
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.
64 # Disk idle timeouts
65 #/sbin/atactl wd0 setidle 30
66 #/sbin/atactl wd0 setstandby 120
68 # Stop the cron daemon
69 #/etc/rc.d/cron stop
71 # Restart syslogd using a diskless configuration
72 #pkill syslogd
73 #/usr/sbin/syslogd -s -f /etc/syslog.conf.battery
75 # All finished
76 exit 0
80 logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
81 exit 1
83 esac