1.\" $NetBSD: powerd.8,v 1.5 2003/04/23 05:46:21 wiz 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 April 23, 2003 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 47acts upon power management events posted by the kernel's power management 48facility. 49When events are posted, 50.Nm 51translates the event into a script name and a list of arguments. 52.Nm 53then runs the script in order to implement the power management policy 54defined by the system administrator. 55.Pp 56.Nm 57supports the following options: 58.Bl -tag -width xxxx 59.It Fl d 60Enable debugging mode. 61Verbose messages will be sent to stderr and 62.Nm 63will stay in the foreground of the controlling terminal. 64.El 65.Sh CONFIGURATION SCRIPTS 66All of 67.Nm Ns 's 68configuration is encapsulated into scripts that are run when power 69management events occur. 70.Nm 71will look for these scripts in two locations. 72The first location is 73.Pa /etc/powerd/scripts/\*[Lt]power_type\*[Gt] , 74where 75.Pa \*[Lt]power_type\*[Gt] 76is defined by the power management mechanism supported by the system, 77e.g., 78.Dq apm 79or 80.Dq acpi . 81If the script is not found in the first location, 82.Nm 83looks in 84.Pa /etc/powerd/scripts . 85.Pp 86Configuration scripts are run synchronously, i.e., 87.Nm 88will start the script and wait for its completion before it handles 89the next event. 90.Pp 91Configuration scripts are called with different arguments, depending on 92the script class. 93These classes are described in the following sections. 94.Ss POWER SWITCH SCRIPTS 95Power switch scripts are called when a state change event occurs on 96a power switch device. 97Power switch scripts are called with two arguments: the device with which 98the device is associated, and the event type. 99.Pp 100The following power switch script names are defined: 101.Bl -tag -width "power_button" 102.It power_button 103This script is called when an event occurs on a power button device. 104.It reset_button 105This script is called when an event occurs on a reset button device. 106.It sleep_button 107This script is called when an event occurs on a sleep button device. 108.It lid_switch 109This script is called when an event occurs on a lid switch device. 110.El 111.Pp 112The following events are defined for power switch devices: 113.Bl -tag -width "released" 114.It pressed 115The button was pressed or the lid closed. 116.It released 117The button was released or the lid opened. 118Note that power and sleep button devices usually do not 119post this type of event. 120.El 121.Pp 122The following is an example of how a power button script might be invoked 123when a power button is pressed by the operator: 124.Bd -literal -offset indent 125/etc/powerd/scripts/power_button acpi0 pressed 126.Ed 127.Sh SEE ALSO 128.Xr acpi 4 , 129.Xr apm 4 130.\" .Xr sysmon 4 131.Sh HISTORY 132.Nm 133first appeared in 134.Nx 2.0 . 135.Sh AUTHORS 136.Nm 137was written by 138.An Jason R. Thorpe 139.Aq thorpej@wasabisystems.com 140and contributed by Wasabi Systems, Inc. 141.Sh BUGS 142Due to its synchronous nature 143.Nm 144cannot be trusted to handle events within a certain time. 145