1 .\" $NetBSD: powerd.8,v 1.18 2007/12/22 18:40:21 jmcneill Exp $
3 .\" Copyright (c) 2003 Wasabi Systems, Inc.
4 .\" All rights reserved.
6 .\" Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. All advertising materials mentioning features or use of this software
17 .\" must display the following acknowledgement:
18 .\" This product includes software developed for the NetBSD Project by
19 .\" Wasabi Systems, Inc.
20 .\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
21 .\" or promote products derived from this software without specific prior
22 .\" written permission.
24 .\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
25 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
28 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 .\" POSSIBILITY OF SUCH DAMAGE.
41 .Nd power management daemon for sysmon
47 acts upon power management events posted by the kernel's power management
49 When events are posted,
51 translates the event into a script name and a list of arguments.
53 then runs the script in order to implement the power management policy
54 defined by the system administrator.
57 supports the following option:
60 Enable debugging mode.
61 Verbose messages will be sent to stderr and
63 will stay in the foreground of the controlling terminal.
65 .Sh CONFIGURATION SCRIPTS
68 configuration is encapsulated into scripts that are run when power
69 management events occur.
71 will look for these scripts in two locations.
73 .Pa /etc/powerd/scripts/\*[Lt]power_type\*[Gt] ,
76 is defined by the power management mechanism supported by the system,
81 If the script is not found in the first location,
84 .Pa /etc/powerd/scripts .
86 Configuration scripts are run synchronously, i.e.,
88 will start the script and wait for its completion before it handles
91 Configuration scripts are called with different arguments, depending on
93 These classes are described in the following sections.
94 .Ss POWER SWITCH SCRIPTS
95 Power switch scripts are called when a state change event occurs on
96 a power switch device.
97 Power switch scripts are called with two arguments: the device with which
98 the device is associated, and the event type.
100 The following power switch script names are defined:
101 .Bl -tag -width "power_button"
103 This script is called when an event occurs on a power button device.
105 This script is called when an event occurs on a reset button device.
107 This script is called when an event occurs on a sleep button device.
109 This script is called when an event occurs on a lid switch device.
111 This script is called when an online or offline event occurs on an
114 This script is called when an event occurs on a hotkey button device.
117 The following events are defined for power switch devices:
118 .Bl -tag -width "released"
120 The button was pressed, the lid closed, or the AC adapter connected.
122 The button was released, the lid opened, or the AC adapter disconnected.
123 Note that power and sleep button devices usually do not
124 post this type of event.
127 The following is an example of how a power button script might be invoked
128 when a power button is pressed by the operator:
129 .Bd -literal -offset indent
130 /etc/powerd/scripts/power_button acpi0 pressed
134 scripts are called when a condition was triggered in a sensor.
135 These scripts are called with three arguments: the
136 device associated, the event type and sensor's name.
141 scripts uses a fourth argument: state description.
143 The following envsys script names are defined:
144 .Bl -tag -width "sensor_temperature"
146 This script is called when an event occurs on a battery sensor
147 (Wh/Ah/Battery state).
149 This script is called when an event occurs on a drive sensor.
151 This script is called when an event occurs on a fan sensor.
153 This script is called when an event ocurrs on a indicator/integer sensor.
155 This script is called when an event occurs on a power sensor (W/Ampere).
156 .It sensor_resistance
157 This script is called when an event occurs on a resistance sensor (Ohm).
158 .It sensor_temperature
159 This script is called when an event occurs on a temperature sensor.
161 This script is called when an event occurs on a voltage sensor.
164 The following event is defined for all scripts but is only sent if
165 a critical/warning or any other event was previously sent:
166 .Bl -tag -width "sensor_temperature"
168 A normal state/capacity/condition was triggered.
171 The following events are defined for fan, indicator, power,
172 resistance, temperature and voltage sensors:
173 .Bl -tag -width "sensor_temperature"
175 A critical condition was triggered.
177 A critical under condition was triggered.
179 A critical over condition was triggered.
181 A warning under condition was triggered.
183 A warning over condition was triggered.
186 The following events are defined only for battery sensors:
187 .Bl -tag -width "sensor_temperature"
189 Capacity dropped below the limit set by the user.
191 System is running in low power, that means that there is not
192 any AC Adapter connected and all batteries are in critical or
194 When this event is received there's no much time so you should only
195 suspend or shutdown the system.
196 The script shutdowns the system gracefully by default.
199 The following events are defined for drive and battery sensors:
200 .Bl -tag -width "sensor_temperature"
202 The state on the sensor has been changed and it's not in normal state.
205 The following is an example of how a temperature sensor script might be
206 invoked when a critical over condition is triggered:
207 .Bd -literal -offset indent
208 /etc/powerd/scripts/sensor_temperature lm0 critical-over "CPU Temp"
229 .Aq thorpej@wasabisystems.com
230 and contributed by Wasabi Systems, Inc.
231 .An Juan Romero Pardines
232 added support to handle
236 Due to its synchronous nature
238 cannot be trusted to handle events within a certain time.