NetBSD/usr.sbin/powerd/powerd.8

150 lines
4.8 KiB
Groff

.\" $NetBSD: powerd.8,v 1.8 2004/05/03 14:23:12 wiz Exp $
.\"
.\" Copyright (c) 2003 Wasabi Systems, Inc.
.\" All rights reserved.
.\"
.\" Written by Jason R. Thorpe for Wasabi Systems, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed for the NetBSD Project by
.\" Wasabi Systems, Inc.
.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
.\" or promote products derived from this software without specific prior
.\" written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd May 3, 2004
.Dt POWERD 8
.Os
.Sh NAME
.Nm powerd
.Nd power management daemon for sysmon
.Sh SYNOPSIS
.Nm
.Op Fl d
.Sh DESCRIPTION
.Nm
acts upon power management events posted by the kernel's power management
facility.
When events are posted,
.Nm
translates the event into a script name and a list of arguments.
.Nm
then runs the script in order to implement the power management policy
defined by the system administrator.
.Pp
.Nm
supports the following options:
.Bl -tag -width xxxx
.It Fl d
Enable debugging mode.
Verbose messages will be sent to stderr and
.Nm
will stay in the foreground of the controlling terminal.
.El
.Sh CONFIGURATION SCRIPTS
All of
.Nm Ns 's
configuration is encapsulated into scripts that are run when power
management events occur.
.Nm
will look for these scripts in two locations.
The first location is
.Pa /etc/powerd/scripts/\*[Lt]power_type\*[Gt] ,
where
.Aq Pa power_type
is defined by the power management mechanism supported by the system,
e.g.,
.Dq apm
or
.Dq acpi .
If the script is not found in the first location,
.Nm
looks in
.Pa /etc/powerd/scripts .
.Pp
Configuration scripts are run synchronously, i.e.,
.Nm
will start the script and wait for its completion before it handles
the next event.
.Pp
Configuration scripts are called with different arguments, depending on
the script class.
These classes are described in the following sections.
.Ss POWER SWITCH SCRIPTS
Power switch scripts are called when a state change event occurs on
a power switch device.
Power switch scripts are called with two arguments: the device with which
the device is associated, and the event type.
.Pp
The following power switch script names are defined:
.Bl -tag -width "power_button"
.It power_button
This script is called when an event occurs on a power button device.
.It reset_button
This script is called when an event occurs on a reset button device.
.It sleep_button
This script is called when an event occurs on a sleep button device.
.It lid_switch
This script is called when an event occurs on a lid switch device.
.It acadapter
This script is called when an online or offline event occurs on an AC adapter device.
.El
.Pp
The following events are defined for power switch devices:
.Bl -tag -width "released"
.It pressed
The button was pressed, the lid closed, or the AC adapter connected.
.It released
The button was released, the lid opened, or the AC adapter disconnected.
Note that power and sleep button devices usually do not
post this type of event.
.El
.Pp
The following is an example of how a power button script might be invoked
when a power button is pressed by the operator:
.Bd -literal -offset indent
/etc/powerd/scripts/power_button acpi0 pressed
.Ed
.Sh SEE ALSO
.Xr acpi 4 ,
.Xr acpiacad 4 ,
.Xr acpibut 4 ,
.Xr acpilid 4 ,
.Xr apm 4
.\" .Xr sysmon 4
.Sh HISTORY
.Nm
first appeared in
.Nx 2.0 .
.Sh AUTHORS
.Nm
was written by
.An Jason R. Thorpe
.Aq thorpej@wasabisystems.com
and contributed by Wasabi Systems, Inc.
.Sh BUGS
Due to its synchronous nature
.Nm
cannot be trusted to handle events within a certain time.