xref: /netbsd-src/usr.sbin/apmd/apmd.8 (revision 1ac719d1471d3ae0a3f0c66e42d0affa92669733)
1.\"	$NetBSD: apmd.8,v 1.22 2012/04/08 22:00:40 wiz Exp $
2.\"
3.\" Copyright (c) 1996, 2010 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 March 20, 2010
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.Op Fl f Ar devname
40.Op Fl m Ar sockmode
41.Op Fl o Ar sockowner:sockgroup
42.Op Fl S Ar sockname
43.Op Fl t Ar rate
44.Sh DESCRIPTION
45The
46.Nm
47daemon monitors the Advanced Power Management
48.Pq Tn APM
49pseudo-device, acting on
50signaled events and upon user requests as sent by the
51.Xr apm 8
52utility.
53The
54.Nm
55daemon is only installed on supported platforms.
56.Pp
57.Em The
58.Nm
59.Em is largely deprecated.
60Modern systems supporting
61.Tn ACPI
62should rely on
63.Xr acpi 4 ,
64.Xr powerd 8 ,
65and the
66.Xr envsys 4
67framework instead.
68.Pp
69For suspend and standby request events delivered by the BIOS, or via
70.Xr apm 8 ,
71.Nm
72runs the appropriate configuration program (if one exists),
73syncs the buffer cache to disk and initiates the requested mode.
74When resuming after suspend or standby,
75.Nm
76runs the appropriate configuration utility (if one exists).
77For power status change events,
78.Nm
79fetches the current status and reports it via
80.Xr syslog 3
81with logging facility
82.Dv LOG_DAEMON .
83.Pp
84.Nm
85announces the transition to standby mode with a single high tone on the
86speaker (using the
87.Pa /dev/speaker
88device).
89Suspends are announced with two high tones.
90.Pp
91.Nm
92periodically polls the
93.Tn APM
94driver for the current power state.
95If the battery charge level changes substantially or the external power
96status changes, the new status is logged.
97The polling rate defaults to
98once per 10 minutes, but this may be altered by using the
99.Fl t
100command-line flag.
101.Pp
102.Nm
103supports the following options:
104.Bl -tag -width Fl
105.It Fl a
106Any BIOS-initiated suspend or standby requests are
107ignored if the system is connected to line current and not running from
108batteries (user requests are still honored).
109.It Fl d
110Enter debug mode, log to facility
111.Dv LOG_LOCAL1
112and stay in the foreground on the controlling terminal.
113.It Fl f Ar devname
114Specify an alternate device file name.
115.It Fl l
116A low-battery event causes a suspend request to occur.
117.It Fl m Ar sockmode
118Use
119.Ar sockmode
120instead of
121.Sq 0660
122for the mode of
123.Pa /var/run/apmdev .
124.It Fl o Ar sockowner:sockgroup
125Use
126.Ar sockowner:sockgroup
127instead of
128.Sq `0:0'
129for the owner/group of
130.Pa /var/run/apmdev .
131.It Fl q
132Do not announce suspend and standby requests on the speaker.
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 s
139The current battery statistics are reported via
140.Xr syslog 3
141and exit without monitoring the APM status.
142.It Fl t Ar rate
143Change the polling rate from 600 seconds to
144.Ar rate
145seconds.
146.It Fl v
147Periodically log the power status via
148.Xr syslog 3 .
149.El
150.Pp
151When a client requests a suspend or stand-by mode,
152.Nm
153does not wait for positive confirmation that the requested
154mode has been entered before replying to the client; to do so would mean
155the client does not get a reply until the system resumes from its sleep state.
156Rather,
157.Nm
158replies with the intended state to the client and then places the system
159in the requested mode after running the configuration script and
160flushing the buffer cache.
161.Pp
162Actions can be configured for the five transitions:
163.Cm suspend ,
164.Cm standby ,
165.Cm resume ,
166.Cm line
167or
168.Cm battery .
169The suspend and standby actions are run prior to
170.Nm
171performing any other actions (such as disk syncs) and entering the new
172mode.
173The resume program is run after resuming from a stand-by or suspended state.
174.Pp
175The line and battery actions are run after switching power sources to
176AC (line) or battery, respectively.
177The appropriate line or battery action
178is also run upon the startup of apmd based on the current power source.
179.Sh FILES
180.Bl -tag -width /etc/apm/suspend -compact
181.It Pa /etc/apm/suspend
182.It Pa /etc/apm/standby
183.It Pa /etc/apm/resume
184.It Pa /etc/apm/line
185.It Pa /etc/apm/battery
186Contain the host's customized actions.
187Each file must be an executable binary or shell script suitable
188for execution by the
189.Xr execve 2
190function.
191If you wish to have the same program or script control all transitions, it
192may determine which transition is in progress by examining its
193.Va argv[0]
194which is set to one of
195.Ar suspend ,
196.Ar standby ,
197.Ar resume ,
198.Ar line
199or
200.Ar battery .
201See
202.Pa /usr/share/examples/apm/script
203for such an example script.
204.Pp
205.It Pa /var/run/apmdev
206The default UNIX-domain socket used for communication with
207.Xr apm 8 .
208The socket is protected by default to mode 0660, UID 0, GID 0.
209.Pp
210.It Pa /dev/apmctl
211The default device used to control the APM kernel driver.
212.El
213.Sh SEE ALSO
214.Xr execve 2 ,
215.Xr syslog 3 ,
216.Xr apm 4 ,
217.Xr speaker 4 ,
218.Xr apm 8 ,
219.Xr syslogd 8
220.Sh HISTORY
221The
222.Nm
223daemon appeared in
224.Nx 1.3 .
225