1.\" $NetBSD: apmd.8,v 1.17 2003/02/25 10:36:04 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 November 5, 2000 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. The polling rate defaults to 93once per 10 minutes, but may be specified using the 94.Fl t 95command-line flag. 96.Pp 97.Nm 98supports the following options: 99.Bl -tag -width Fl 100.It Fl a 101Any BIOS-initiated suspend or standby requests are 102ignored if the system is connected to line current and not running from 103batteries (user requests are still honored). 104.It Fl d 105Enter debug mode, log to facility 106.Dv LOG_LOCAL1 107and stay in the foreground on the controlling terminal. 108.It Fl f Ar devname 109Specify an alternate device file name. 110.It Fl l 111A low-battery event causes a suspend request to occur. 112.It Fl m Ar sockmode 113Use 114.Ar sockmode 115instead of 116.Sq 0660 117for the mode of 118.Pa /var/run/apmdev . 119.It Fl o Ar sockowner:sockgroup 120Use 121.Ar sockowner:sockgroup 122instead of 123.Sq `0:0' 124for the owner/group of 125.Pa /var/run/apmdev . 126.It Fl q 127Do not announce suspend and standby requests on the speaker. 128.It Fl s 129The current battery statistics are reported via 130.Xr syslog 3 131and exit without monitoring the APM status. 132.It Fl S Ar sockname 133Specify an alternate socket name (used by 134.Xr apm 8 135to communicate with 136.Nm ) . 137.It Fl t Ar rate 138Change the polling rate from 10 seconds to 139.Ar rate 140seconds. 141.It Fl v 142Periodically log the power status via 143.Xr syslog 3 . 144.El 145.Pp 146When a client requests a suspend or stand-by mode, 147.Nm 148does not wait for positive confirmation that the requested 149mode has been entered before replying to the client; to do so would mean 150the client does not get a reply until the system resumes from its sleep state. 151Rather, 152.Nm 153replies with the intended state to the client and then places the system 154in the requested mode after running the configuration script and 155flushing the buffer cache. 156.Pp 157Actions can be configured for the five transitions: 158.Cm suspend , 159.Cm standby , 160.Cm resume , 161.Cm line 162or 163.Cm battery . 164The suspend and standby actions are run prior to 165.Nm 166performing any other actions (such as disk syncs) and entering the new 167mode. The resume program is run after resuming from a stand-by or 168suspended state. 169.Pp 170The line and battery actions are run after switching power sources to 171AC (line) or battery, respectively. The appropriate line or battery action 172is also run upon the startup of apmd based on the current power source. 173.Sh FILES 174.Bl -tag -width /etc/apm/suspend -compact 175.It Pa /etc/apm/suspend 176.It Pa /etc/apm/standby 177.It Pa /etc/apm/resume 178.It Pa /etc/apm/line 179.It Pa /etc/apm/battery 180Contain the host's customized actions. 181Each file must be an executable binary or shell script suitable 182for execution by the 183.Xr execve 2 184function. 185If you wish to have the same program or script control all transitions, it 186may determine which transition is in progress by examining its 187.Va argv[0] 188which is set to one of 189.Ar suspend , 190.Ar standby , 191.Ar resume , 192.Ar line 193or 194.Ar battery . 195See 196.Pa /usr/share/examples/apm/script 197for such an example script. 198.Pp 199.It Pa /var/run/apmdev 200The default UNIX-domain socket used for communication with 201.Xr apm 8 . 202The socket is protected by default to mode 0660, UID 0, GID 0. 203.Pp 204.It Pa /dev/apmctl 205The default device used to control the APM kernel driver. 206.El 207.Sh SEE ALSO 208.Xr execve 2 , 209.Xr syslog 3 , 210.Xr apm 4 , 211.Xr speaker 4 , 212.Xr apm 8 , 213.Xr syslogd 8 214.Sh REFERENCES 215Advanced Power Management (APM) BIOS Interface Specification (revision 2161.1), Intel Corporation and Microsoft Corporation. 217.Sh HISTORY 218The 219.Nm 220command appeared in 221.Nx 1.3 . 222