1.\" $OpenBSD: apmd.8,v 1.43 2010/10/28 18:21:20 jmc Exp $ 2.\" 3.\" Copyright (c) 1995 John T. Kohl 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. The name of the author may not be used to endorse or promote products 15.\" derived from this software without specific prior written permission. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 21.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 26.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.\" POSSIBILITY OF SUCH DAMAGE. 28.\" 29.Dd $Mdocdate: October 28 2010 $ 30.Dt APMD 8 31.Os 32.Sh NAME 33.Nm apmd 34.Nd Advanced Power Management daemon 35.Sh SYNOPSIS 36.Nm apmd 37.Op Fl AaCdHLs 38.Op Fl f Ar devname 39.Op Fl S Ar sockname 40.Op Fl t Ar seconds 41.Sh DESCRIPTION 42.Nm 43monitors the advanced power management device, 44.Xr apm 4 , 45acting on signaled events and upon user requests as sent by the 46.Xr apm 8 47program. 48.Pp 49For suspend and standby request events delivered by the BIOS, or via 50.Xr apm 8 , 51.Nm 52runs the appropriate configuration program (if one exists), 53syncs the buffer cache to disk and initiates the requested state. 54When resuming after suspend or standby, 55.Nm 56runs the appropriate configuration program (if one exists). 57.Pp 58When the power status changes 59(battery is connected or disconnected) 60.Nm 61fetches the current status and reports it via 62.Xr syslog 3 63with logging facility 64.Dv LOG_DAEMON . 65.Pp 66The options are as follows: 67.Bl -tag -width Ds 68.It Fl A 69Start 70.Nm 71in automatic performance adjustment mode. 72In this mode, when CPU idle time falls below 10%, 73or if the AC power is connected and the battery is more than 15% charged, 74or if the battery is absent, 75.Nm 76raises 77.Va hw.setperf 78to 100. 79Otherwise when CPU idle time is above 30% 80and the system is running on battery power, 81.Nm 82lowers 83.Va hw.setperf 84as much as possible to reduce power consumption. 85.It Fl a 86BIOS-initiated suspend or standby requests are 87ignored if the system is connected to line current and not running from 88batteries (user requests are still honored). 89.It Fl C 90Start 91.Nm 92in cool running performance adjustment mode. 93In this mode, when CPU idle time falls below 10%, 94.Nm 95raises 96.Va hw.setperf 97as much as necessary. 98Otherwise when CPU idle time is above 30%, 99.Nm 100lowers 101.Va hw.setperf 102as much as possible to reduce heat, noise, and power consumption. 103.It Fl d 104.Nm 105enters debug mode, logging to facility 106.Dv LOG_LOCAL1 , 107and stays in the foreground on the controlling terminal. 108.It Fl f Ar devname 109Specify an alternate device file name, 110.Ar devname . 111.It Fl H 112Start 113.Nm 114in manual performance adjustment mode, initialising 115.Va hw.setperf 116to 100. 117.It Fl L 118Start 119.Nm 120in manual performance adjustment mode, initialising 121.Va hw.setperf 122to 0. 123.It Fl S Ar sockname 124Specify an alternate socket name, 125.Ar sockname . 126The socket is protected to mode 0660, UID 0, GID 0; this protects access 127to suspend requests to authorized users only. 128.It Fl s 129Current battery statistics are reported via 130.Xr syslog 3 131and 132.Nm 133exits without monitoring the APM status. 134.It Fl t Ar seconds 135.Nm 136periodically polls the APM driver for the current power state. 137If the battery charge level changes substantially or the external power 138status changes, the new status is logged. 139The polling rate defaults to 140once per 10 minutes, but may be specified using the 141.Fl t 142command-line flag. 143.El 144.Pp 145When a client requests a suspend or stand-by state, 146.Nm 147does not wait for positive confirmation that the requested 148state has been entered before replying to the client; to do so would mean 149the client does not get a reply until the system resumes from its sleep state. 150Rather, 151.Nm 152replies with the intended state to the client and then places the system 153in the requested state after running the configuration script and 154flushing the buffer cache. 155.Pp 156Actions can be configured for the following five transitions: 157suspend, 158standby, 159resume, 160powerup, 161and 162powerdown. 163The suspend and standby actions are run prior to 164.Nm 165performing any other actions (such as disk syncs) and entering the new 166state. 167The resume program is run after resuming from a stand-by or 168suspended state. 169The powerup and powerdown programs are run after the power status (AC 170connected or not) changes, as well as after a resume (if the power 171status changed in the mean time). 172.Sh FILES 173.Bl -tag -width "/etc/apm/powerdownXX" -compact 174.It /dev/apmctl 175Default device used to control the APM kernel driver. 176.Pp 177.It /etc/apm/suspend 178.It /etc/apm/standby 179.It /etc/apm/resume 180.It /etc/apm/powerup 181.It /etc/apm/powerdown 182These files contain the host's customized actions. 183Each file must be an executable binary or shell script. 184A single program or script can be used to control all transitions 185by examining the name by which it was called, 186which is one of 187suspend, 188standby, 189resume, 190powerup, 191or 192powerdown. 193.Pp 194.It /var/run/apmdev 195Default 196.Ux Ns -domain 197socket used for communication with 198.Xr apm 8 . 199.El 200.Sh SEE ALSO 201.Xr syslog 3 , 202.Xr apm 4 , 203.Xr apm 8 , 204.Xr sysctl 8 205.Pp 206Advanced Power Management (APM) BIOS Interface Specification 207(revision 1.2), 208Intel Corporation and Microsoft Corporation. 209.Sh HISTORY 210The 211.Nm 212command first appeared in 213.Nx 1.3 . 214.Ox 215support was added in 216.Ox 1.2 . 217