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