xref: /netbsd-src/usr.sbin/apmd/apmd.8 (revision 274254cdae52594c1aa480a736aef78313d15c9c)
1.\"	$NetBSD: apmd.8,v 1.20 2008/09/25 22:44:51 reed Exp $
2.\"
3.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by John Kohl.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd May 16, 2004
31.Dt APMD 8
32.Os
33.Sh NAME
34.Nm apmd
35.Nd Advanced Power Management monitor daemon
36.Sh SYNOPSIS
37.Nm
38.Op Fl adlqsv
39.Bk -words
40.Op Fl t Ar rate
41.Ek
42.Bk -words
43.Op Fl S Ar sockname
44.Ek
45.Bk -words
46.Op Fl m Ar sockmode
47.Ek
48.Bk -words
49.Op Fl o Ar sockowner:sockgroup
50.Ek
51.Bk -words
52.Op Fl f Ar devname
53.Ek
54.Sh DESCRIPTION
55.Nm
56monitors the advanced power management (APM) pseudo-device, acting on
57signaled events and upon user requests as sent by the
58.Xr apm 8
59utility.
60The
61.Nm
62daemon is only installed on supported platforms.
63.Pp
64For suspend and standby request events delivered by the BIOS, or via
65.Xr apm 8 ,
66.Nm
67runs the appropriate configuration program (if one exists),
68syncs the buffer cache to disk and initiates the requested mode.
69When resuming after suspend or standby,
70.Nm
71runs the appropriate configuration utility (if one exists).
72For power status change events,
73.Nm
74fetches the current status and reports it via
75.Xr syslog 3
76with logging facility
77.Dv LOG_DAEMON .
78.Pp
79.Nm
80announces the transition to standby mode with a single high tone on the
81speaker (using the
82.Pa /dev/speaker
83device).
84Suspends are announced with two high tones.
85.Pp
86.Nm
87periodically polls the APM driver for the current power state.
88If the battery charge level changes substantially or the external power
89status changes, the new status is logged.
90The polling rate defaults to
91once per 10 minutes, but may be specified using the
92.Fl t
93command-line flag.
94.Pp
95.Nm
96supports the following options:
97.Bl -tag -width Fl
98.It Fl a
99Any BIOS-initiated suspend or standby requests are
100ignored if the system is connected to line current and not running from
101batteries (user requests are still honored).
102.It Fl d
103Enter debug mode, log to facility
104.Dv LOG_LOCAL1
105and stay in the foreground on the controlling terminal.
106.It Fl f Ar devname
107Specify an alternate device file name.
108.It Fl l
109A low-battery event causes a suspend request to occur.
110.It Fl m Ar sockmode
111Use
112.Ar sockmode
113instead of
114.Sq 0660
115for the mode of
116.Pa /var/run/apmdev .
117.It Fl o Ar sockowner:sockgroup
118Use
119.Ar sockowner:sockgroup
120instead of
121.Sq `0:0'
122for the owner/group of
123.Pa /var/run/apmdev .
124.It Fl q
125Do not announce suspend and standby requests on the speaker.
126.It Fl s
127The current battery statistics are reported via
128.Xr syslog 3
129and exit without monitoring the APM status.
130.It Fl S Ar sockname
131Specify an alternate socket name (used by
132.Xr apm 8
133to communicate with
134.Nm ) .
135.It Fl t Ar rate
136Change the polling rate from 600 seconds to
137.Ar rate
138seconds.
139.It Fl v
140Periodically log the power status via
141.Xr syslog 3 .
142.El
143.Pp
144When a client requests a suspend or stand-by mode,
145.Nm
146does not wait for positive confirmation that the requested
147mode has been entered before replying to the client; to do so would mean
148the client does not get a reply until the system resumes from its sleep state.
149Rather,
150.Nm
151replies with the intended state to the client and then places the system
152in the requested mode after running the configuration script and
153flushing the buffer cache.
154.Pp
155Actions can be configured for the five transitions:
156.Cm suspend ,
157.Cm standby ,
158.Cm resume ,
159.Cm line
160or
161.Cm battery .
162The suspend and standby actions are run prior to
163.Nm
164performing any other actions (such as disk syncs) and entering the new
165mode.
166The resume program is run after resuming from a stand-by or suspended state.
167.Pp
168The line and battery actions are run after switching power sources to
169AC (line) or battery, respectively.
170The appropriate line or battery action
171is also run upon the startup of apmd based on the current power source.
172.Sh FILES
173.Bl -tag -width /etc/apm/suspend -compact
174.It Pa /etc/apm/suspend
175.It Pa /etc/apm/standby
176.It Pa /etc/apm/resume
177.It Pa /etc/apm/line
178.It Pa /etc/apm/battery
179Contain the host's customized actions.
180Each file must be an executable binary or shell script suitable
181for execution by the
182.Xr execve 2
183function.
184If you wish to have the same program or script control all transitions, it
185may determine which transition is in progress by examining its
186.Va argv[0]
187which is set to one of
188.Ar suspend ,
189.Ar standby ,
190.Ar resume ,
191.Ar line
192or
193.Ar battery .
194See
195.Pa /usr/share/examples/apm/script
196for such an example script.
197.Pp
198.It Pa /var/run/apmdev
199The default UNIX-domain socket used for communication with
200.Xr apm 8 .
201The socket is protected by default to mode 0660, UID 0, GID 0.
202.Pp
203.It Pa /dev/apmctl
204The default device used to control the APM kernel driver.
205.El
206.Sh SEE ALSO
207.Xr execve 2 ,
208.Xr syslog 3 ,
209.Xr apm 4 ,
210.Xr speaker 4 ,
211.Xr apm 8 ,
212.Xr syslogd 8
213.Sh REFERENCES
214Advanced Power Management (APM) BIOS Interface Specification (revision
2151.1), Intel Corporation and Microsoft Corporation.
216.Sh HISTORY
217The
218.Nm
219command appeared in
220.Nx 1.3 .
221