xref: /openbsd/usr.sbin/apmd/apmd.8 (revision a6445c1d)
1.\"	$OpenBSD: apmd.8,v 1.45 2014/10/17 01:55:00 tedu Exp $
2.\"
3.\" Copyright (c) 1995 John T. Kohl
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. The name of the author may not be used to endorse or promote products
15.\"    derived from this software without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20.\" DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27.\" POSSIBILITY OF SUCH DAMAGE.
28.\"
29.Dd $Mdocdate: October 17 2014 $
30.Dt APMD 8
31.Os
32.Sh NAME
33.Nm apmd
34.Nd Advanced Power Management daemon
35.Sh SYNOPSIS
36.Nm apmd
37.Op Fl AadHLs
38.Op Fl f Ar devname
39.Op Fl S Ar sockname
40.Op Fl t Ar seconds
41.Sh DESCRIPTION
42.Nm
43monitors the advanced power management device,
44.Xr apm 4 ,
45acting on signaled events and upon user requests as sent by the
46.Xr apm 8
47program.
48.Pp
49For suspend and standby request events delivered by the BIOS, or via
50.Xr apm 8 ,
51.Nm
52runs the appropriate configuration program (if one exists),
53syncs the buffer cache to disk and initiates the requested state.
54When resuming after suspend or standby,
55.Nm
56runs the appropriate configuration program (if one exists).
57.Pp
58When the power status changes
59(battery is connected or disconnected)
60.Nm
61fetches the current status and reports it via
62.Xr syslog 3
63with logging facility
64.Dv LOG_DAEMON .
65.Pp
66The options are as follows:
67.Bl -tag -width Ds
68.It Fl A
69Start
70.Nm
71in automatic performance adjustment mode.
72.It Fl a
73BIOS-initiated suspend or standby requests are
74ignored if the system is connected to line current and not running from
75batteries (user requests are still honored).
76.It Fl d
77.Nm
78enters debug mode, logging to facility
79.Dv LOG_LOCAL1 ,
80and stays in the foreground on the controlling terminal.
81.It Fl f Ar devname
82Specify an alternate device file name,
83.Ar devname .
84.It Fl H
85Start
86.Nm
87in manual performance adjustment mode, initialising
88.Va hw.setperf
89to 100.
90.It Fl L
91Start
92.Nm
93in manual performance adjustment mode, initialising
94.Va hw.setperf
95to 0.
96.It Fl S Ar sockname
97Specify an alternate socket name,
98.Ar sockname .
99The socket is protected to mode 0660, UID 0, GID 0; this protects access
100to suspend requests to authorized users only.
101.It Fl s
102Current battery statistics are reported via
103.Xr syslog 3
104and
105.Nm
106exits without monitoring the APM status.
107.It Fl t Ar seconds
108.Nm
109periodically polls the APM driver for the current power state.
110If the battery charge level changes substantially or the external power
111status changes, the new status is logged.
112The polling rate defaults to
113once per 10 minutes, but may be specified using the
114.Fl t
115command-line flag.
116.El
117.Pp
118When a client requests a suspend or stand-by state,
119.Nm
120does not wait for positive confirmation that the requested
121state has been entered before replying to the client; to do so would mean
122the client does not get a reply until the system resumes from its sleep state.
123Rather,
124.Nm
125replies with the intended state to the client and then places the system
126in the requested state after running the configuration script and
127flushing the buffer cache.
128.Pp
129Actions can be configured for the following five transitions:
130suspend,
131standby,
132resume,
133powerup,
134and
135powerdown.
136The suspend and standby actions are run prior to
137.Nm
138performing any other actions (such as disk syncs) and entering the new
139state.
140The resume program is run after resuming from a stand-by or
141suspended state.
142The powerup and powerdown programs are run after the power status (AC
143connected or not) changes, as well as after a resume (if the power
144status changed in the mean time).
145.Sh FILES
146.Bl -tag -width "/etc/apm/powerdownXX" -compact
147.It /dev/apmctl
148Default device used to control the APM kernel driver.
149.Pp
150.It /etc/apm/suspend
151.It /etc/apm/standby
152.It /etc/apm/resume
153.It /etc/apm/powerup
154.It /etc/apm/powerdown
155These files contain the host's customized actions.
156Each file must be an executable binary or shell script.
157A single program or script can be used to control all transitions
158by examining the name by which it was called,
159which is one of
160suspend,
161standby,
162resume,
163powerup,
164or
165powerdown.
166.Pp
167.It /var/run/apmdev
168Default
169.Ux Ns -domain
170socket used for communication with
171.Xr apm 8 .
172.El
173.Sh SEE ALSO
174.Xr syslog 3 ,
175.Xr apm 4 ,
176.Xr apm 8 ,
177.Xr sysctl 8
178.Pp
179Advanced Power Management (APM) BIOS Interface Specification
180(revision 1.2),
181Intel Corporation and Microsoft Corporation.
182.Sh HISTORY
183The
184.Nm
185command first appeared in
186.Nx 1.3 .
187.Ox
188support was added in
189.Ox 1.2 .
190