.\"	$OpenBSD: apm.8,v 1.31 2007/05/31 19:20:22 jmc Exp $
.\"
.\" Copyright (c) 1996 John T. Kohl
.\" All rights reserved.
.\"
.\" 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. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 THE AUTHOR 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 $Mdocdate: May 31 2007 $
.Dt APM 8
.Os
.Sh NAME
.Nm apm
.Nd Advanced Power Management control program
.Sh SYNOPSIS
.Nm zzz
.Op Fl Sz
.Op Fl f Ar sockname
.Br
.Nm apm
.Op Fl AabCHLlmPSvz
.Op Fl f Ar sockname
.Sh DESCRIPTION
.Nm
communicates with the Advanced Power Management daemon,
.Xr apmd 8 ,
making requests of it for current power status or to place the system
into a suspend or stand-by state.
With no flags,
.Nm
displays the current power management state in verbose form.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl A
Set
.Xr apmd 8
to automatic performance adjustment mode.
In this mode, when CPU idle time falls below 10%,
or if the AC power is connected and the battery is more than 15% charged,
.Nm
raises
.Va hw.setperf
as much as possible.
Otherwise, when the CPU idle time
is above 30% and the system is running on battery power,
.Nm
lowers
.Va hw.setperf
as much as possible to reduce power consumption.
.It Fl a
Display the external charger (A/C status).
0 means disconnected, 1
means connected, 2 means backup power source, and 255 means unknown.
.It Fl b
Display the battery status.
0 means high, 1 means low, 2 means
critical, 3 means charging, 4 means absent, and 255 means unknown.
.It Fl C
Set
.Xr apmd 8
to cool running performance adjustment mode.
In this mode, when CPU idle time falls below
10%,
.Nm
raises
.Va hw.setperf
as much as necessary.
Otherwise, when idle time is above 30%
.Nm
reduces
.Va hw.setperf
as much as possible to reduce heat, noise, and power consumption.
.It Fl f Ar sockname
Set the name of the socket via which to contact
.Xr apmd 8
to
.Pa sockname .
.It Fl H
Set
.Xr apmd 8
to manual performance adjustment mode and
.Va hw.setperf
to 100.
.It Fl L
Set
.Xr apmd 8
to manual performance adjustment mode and
.Va hw.setperf
to 0.
.It Fl l
Display the estimated battery lifetime (in percent).
.It Fl m
Display the estimated battery lifetime (in minutes).
.It Fl P
Display the performance adjustment mode.
0 means manual mode, 1 means automatic mode, and 2 means cool running mode.
.It Fl S
Put the system into stand-by (light sleep) state.
.It Fl v
Request more verbose description of the displayed states.
.It Fl z
Put the system into suspend (deep sleep) state.
.El
.Pp
The
.Nm zzz
variant of this command is an alternative for suspending the system.
With no arguments,
.Nm zzz
places the system into suspend state.
The command line flags serve the same purpose as for the
.Nm
variant of this command.
.Pp
This command does not wait for positive confirmation that the requested
state has been entered; to do so would mean the command does not return
until the system resumes from its sleep state.
.Sh FILES
.Bl -tag -width /var/run/apmdev -compact
.It Pa /var/run/apmdev
default Unix domain socket for communicating with
.Xr apmd 8
.El
.Pp
The
.Fl f
flag may be used to specify an alternate socket name.
The protection modes on this socket govern which users may access the
APM functions.
.Sh SEE ALSO
.Xr apm 4 ,
.Xr apmd 8
.Pp
Advanced Power Management (APM) BIOS Interface Specification
(revision 1.2),
Intel Corporation and Microsoft Corporation
.Sh HISTORY
The
.Nm
command appeared in
.Nx 1.3 ,
.Ox
support was added in
.Ox 1.2 .