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