Fix markup.
[netbsd-mini2440.git] / usr.sbin / powerd / powerd.8
blobde33fe88d1d88532f6eeba1c61883bbe53bfd2dc
1 .\"     $NetBSD: powerd.8,v 1.18 2007/12/22 18:40:21 jmcneill Exp $
2 .\"
3 .\" Copyright (c) 2003 Wasabi Systems, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" Written by Jason R. Thorpe for Wasabi Systems, Inc.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
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.
23 .\"
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.
35 .\"
36 .Dd December 22, 2007
37 .Dt POWERD 8
38 .Os
39 .Sh NAME
40 .Nm powerd
41 .Nd power management daemon for sysmon
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl d
45 .Sh DESCRIPTION
46 .Nm
47 acts upon power management events posted by the kernel's power management
48 facility.
49 When events are posted,
50 .Nm
51 translates the event into a script name and a list of arguments.
52 .Nm
53 then runs the script in order to implement the power management policy
54 defined by the system administrator.
55 .Pp
56 .Nm
57 supports the following option:
58 .Bl -tag -width xxxx
59 .It Fl d
60 Enable debugging mode.
61 Verbose messages will be sent to stderr and
62 .Nm
63 will stay in the foreground of the controlling terminal.
64 .El
65 .Sh CONFIGURATION SCRIPTS
66 All of
67 .Nm
68 configuration is encapsulated into scripts that are run when power
69 management events occur.
70 .Nm
71 will look for these scripts in two locations.
72 The first location is
73 .Pa /etc/powerd/scripts/\*[Lt]power_type\*[Gt] ,
74 where
75 .Aq Pa power_type
76 is defined by the power management mechanism supported by the system,
77 e.g.,
78 .Dq apm
80 .Dq acpi .
81 If the script is not found in the first location,
82 .Nm
83 looks in
84 .Pa /etc/powerd/scripts .
85 .Pp
86 Configuration scripts are run synchronously, i.e.,
87 .Nm
88 will start the script and wait for its completion before it handles
89 the next event.
90 .Pp
91 Configuration scripts are called with different arguments, depending on
92 the script class.
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.
99 .Pp
100 The following power switch script names are defined:
101 .Bl -tag -width "power_button"
102 .It power_button
103 This script is called when an event occurs on a power button device.
104 .It reset_button
105 This script is called when an event occurs on a reset button device.
106 .It sleep_button
107 This script is called when an event occurs on a sleep button device.
108 .It lid_switch
109 This script is called when an event occurs on a lid switch device.
110 .It acadapter
111 This script is called when an online or offline event occurs on an
112 AC adapter device.
113 .It hotkey_button
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"
119 .It pressed
120 The button was pressed, the lid closed, or the AC adapter connected.
121 .It released
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
132 .Ss ENVSYS SCRIPTS
133 .Xr envsys 4
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.
138 .Sy sensor_drive
139 and the
140 .Sy sensor_battery
141 scripts uses a fourth argument: state description.
143 The following envsys script names are defined:
144 .Bl -tag -width "sensor_temperature"
145 .It sensor_battery
146 This script is called when an event occurs on a battery sensor
147 (Wh/Ah/Battery state).
148 .It sensor_drive
149 This script is called when an event occurs on a drive sensor.
150 .It sensor_fan
151 This script is called when an event occurs on a fan sensor.
152 .It sensor_indicator
153 This script is called when an event ocurrs on a indicator/integer sensor.
154 .It sensor_power
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.
160 .It sensor_voltage
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"
167 .It normal
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"
174 .It critical
175 A critical condition was triggered.
176 .It critical-under
177 A critical under condition was triggered.
178 .It critical-over
179 A critical over condition was triggered.
180 .It warning-under
181 A warning under condition was triggered.
182 .It warning-over
183 A warning over condition was triggered.
186 The following events are defined only for battery sensors:
187 .Bl -tag -width "sensor_temperature"
188 .It user-capacity
189 Capacity dropped below the limit set by the user.
190 .It low-power
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
193 low capacity.
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"
201 .It state-changed
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"
210 .Sh SEE ALSO
211 .Xr acpi 4 ,
212 .Xr acpiacad 4 ,
213 .Xr acpibut 4 ,
214 .Xr acpilid 4 ,
215 .Xr envsys 4 ,
216 .Xr i386/apm 4
217 .Sh HISTORY
219 first appeared in
220 .Nx 2.0 .
221 Support to handle
222 .Xr envsys 4
223 events appeared in
224 .Nx 5.0 .
225 .Sh AUTHORS
227 was written by
228 .An Jason R. Thorpe
229 .Aq thorpej@wasabisystems.com
230 and contributed by Wasabi Systems, Inc.
231 .An Juan Romero Pardines
232 added support to handle
233 .Xr envsys 4
234 events.
235 .Sh BUGS
236 Due to its synchronous nature
238 cannot be trusted to handle events within a certain time.