1 .\" Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
2 .\" Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp>
3 .\" Copyright (c) 1999 Yoshihiko SARUMARU Aq <mistral@imasy.or.jp>
4 .\" Copyright (c) 1999 Norihiro Kumagai <kuma@nk.rim.or.jp>
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)apmd.8 1.1 (FreeBSD) 6/28/99
29 .\" $FreeBSD: src/usr.sbin/apmd/apmd.8,v 1.7.2.7 2003/03/11 21:13:47 trhodes Exp $
30 .\" $DragonFly: src/usr.sbin/apmd/apmd.8,v 1.5 2008/05/09 20:31:04 swildner Exp $
37 .Nd Advanced Power Management monitor daemon
47 monitors the occurrence of the specified Advanced Power Management
49 events and, if one of the events occurs, it executes the sequence of
50 commands corresponding to the event. Only the events specified in the
51 configuration file are notified to
53 all other events are ignored. For each event posted by the APM BIOS,
55 invokes the sequence of commands specified in the configuration file.
58 is running with monitoring suspend/standby requests,
59 the kernel will not process those requests.
60 Therefore, if you wish action to be taken when these events
61 occur, you need to explicitly configure the appropriate commands or
62 built-in functions in the configuration file.
66 utility recognizes the following runtime options:
67 .Bl -tag -width -f_file
69 Starts in debug mode. This causes
71 to execute in the foreground instead of in daemon mode.
73 Specifies a different configuration file
75 to be used in place of the default
83 starts, it reads the configuration file
86 and notifies the set of events to be monitored to the APM device driver.
87 When it terminates, the APM device driver automatically cancels
94 it will reread its configuration file and
95 notify the APM device driver of any changes to its configuration.
99 utility uses the device
103 requests for monitoring events and for controlling the APM system.
104 This device file is opened exclusively, so only a single
106 process can be running at any time.
110 receives an APM event, it forks a child process to execute the
111 commands specified in the configuration file and then continues
112 listening for more events. The child process executes the commands
113 specified, one at a time and in the order that they are listed.
117 is processing the command list for SUSPEND/STANDBY requests, the APM kernel
118 device driver issues notifications to APM BIOS once per second so that the
119 BIOS knows that there are still some commands pending, and that it should not
120 complete the request just yet.
124 utility creates the file
125 .Pa /var/run/apmd.pid ,
126 and stores its process
128 This can be used to kill or reconfigure
130 .Sh CONFIGURATION FILE
133 configuration file is quite simple. For example:
135 apm_event SUSPENDREQ {
136 exec "sync && sync && sync";
144 to receive the APM event
146 (which may be posted by an LCD close), run the
148 command 3 times and wait for a while, then execute
149 .Nm zzz ( Ns Nm apm Fl z )
150 to put the system in the suspend state.
153 The apm_event keyword
154 .Bd -ragged -offset indent
156 is the keyword which indicates the start of configuration for
161 .Bd -ragged -offset indent
162 If you wish to execute the same commands for different events, the
163 event names should be delimited by a comma. The following are
167 - Events ignored by the kernel if
171 .Bl -tag -width USERSUSPENDREQ -compact -offset indent
175 should include sync in the command list,
177 should include sync in the command list,
179 only zzz should be specified in the command list.
184 after kernel handling:
186 .Bl -tag -width USERSUSPENDREQ -compact -offset indent
192 .It CAPABILITIESCHANGE
195 Other events will not be sent to
201 .Bd -ragged -offset indent
202 In the example above, the three lines beginning with
204 are commands for the event.
205 Each line should be terminated with a semicolon.
206 The command list for the event should be enclosed by
214 for double-quotation enclosed command execution, just as with
216 Each command is executed in order until the end of
217 the list is reached or a command finishes with a non-zero status code.
220 utility will report any failed command's status code via
222 and will then reject the request event posted by the APM BIOS.
226 .Bd -ragged -offset indent
229 built-in functions instead of command lines.
230 A built-in function name should be terminated with a semicolon,
231 just as with a command line.
232 The following built-in functions are currently supported:
236 .Bd -ragged -offset indent
237 Reject last request posted by APM BIOS. This can be used to reject
238 a SUSPEND request when the LCD is closed and put the system in a
239 STANDBY state instead.
245 .Bl -tag -width /etc/apmd.conf -compact
246 .It Pa /etc/apmd.conf
248 .It Pa /var/run/apmd.pid
251 Sample configuration commands include:
253 apm_event SUSPENDREQ {
254 exec "/etc/rc.suspend";
257 apm_event USERSUSPENDREQ {
258 exec "sync && sync && sync";
263 apm_event NORMRESUME, STANDBYRESUME {
264 exec "/etc/rc.resume";
267 # resume event configuration for serial mouse users by
268 # reinitializing a moused(8) connected to a serial port.
270 #apm_event NORMRESUME {
271 # exec "kill -HUP `cat /var/run/moused.pid`";
274 # suspend request event configuration for ATA HDD users:
275 # execute standby instead of suspend.
277 #apm_event SUSPENDREQ {
279 # exec "sync && sync && sync";
293 .An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org
294 .An KOIE Hidetaka Aq koie@suri.co.jp
296 Some contributions made by
297 .An Warner Losh Aq imp@FreeBSD.org ,
298 .An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp ,
299 .An Yoshihiko SARUMARU Aq mistral@imasy.or.jp ,
300 .An Norihiro Kumagai Aq kuma@nk.rim.or.jp ,
301 .An NAKAGAWA Yoshihisa Aq nakagawa@jp.FreeBSD.org ,
303 .An Nick Hilliard Aq nick@foobar.org .