1.\" $OpenBSD: apmd.8,v 1.53 2021/11/03 19:54:28 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: November 3 2021 $ 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 AadHLs 38.Op Fl f Ar devname 39.Op Fl S Ar sockname 40.Op Fl t Ar seconds 41.Op Fl Z Ar percent 42.Op Fl z Ar percent 43.Sh DESCRIPTION 44.Nm 45monitors the advanced power management device, 46.Xr apm 4 , 47acting on signaled events and upon user requests as sent by the 48.Xr apm 8 49program. 50.Pp 51For suspend and standby request events delivered by the BIOS, or via 52.Xr apm 8 , 53.Nm 54runs the appropriate configuration program (if one exists), 55syncs the buffer cache to disk and initiates the requested state. 56When resuming after suspend or standby, 57.Nm 58runs the appropriate configuration program (if one exists). 59.Pp 60When the power status changes 61(battery is connected or disconnected) 62.Nm 63fetches the current status and reports it via 64.Xr syslog 3 65with logging facility 66.Dv LOG_DAEMON . 67.Pp 68The options are as follows: 69.Bl -tag -width Ds 70.It Fl A 71Start 72.Nm 73in automatic performance adjustment mode (the default). 74.It Fl a 75BIOS-initiated suspend or standby requests are 76ignored if the system is connected to line current and not running from 77batteries (user requests are still honored). 78.It Fl d 79.Nm 80enters debug mode, staying in the foreground. 81Logging output is printed to stderr. 82.It Fl f Ar devname 83Specify an alternate device file name, 84.Ar devname . 85.It Fl H 86Start 87.Nm 88in manual performance adjustment mode, initialising 89.Va hw.setperf 90to 100. 91.It Fl L 92Start 93.Nm 94in manual performance adjustment mode, initialising 95.Va hw.setperf 96to 0. 97.It Fl S Ar sockname 98Specify an alternate socket name, 99.Ar sockname . 100The socket is protected to mode 0660, UID 0, GID 0; this protects access 101to suspend requests to authorized users only. 102.It Fl s 103Current battery statistics are reported via 104.Xr syslog 3 105and 106.Nm 107exits without monitoring the APM status. 108.It Fl t Ar seconds 109.Nm 110periodically polls the APM driver for the current power state. 111If the battery charge level changes substantially or the external power 112status changes, the new status is logged. 113The polling rate defaults to 114once per 10 minutes, but may be specified using the 115.Fl t 116command-line flag. 117.It Fl Z Ar percent 118Automatically hibernate the system if no AC is connected and the 119estimated battery life is equal or below 120.Ar percent . 121.It Fl z Ar percent 122Automatically suspend the system if no AC is connected and the 123estimated battery life is equal or below 124.Ar percent . 125.Pp 126If both 127.Fl Z 128and 129.Fl z 130are specified, the last one will supersede the other. 131After a resume, the effect of those options is inhibited for 60 seconds. 132.El 133.Pp 134When a client requests a suspend or stand-by state, 135.Nm 136does not wait for positive confirmation that the requested 137state has been entered before replying to the client; to do so would mean 138the client does not get a reply until the system resumes from its sleep state. 139Rather, 140.Nm 141replies with the intended state to the client and then places the system 142in the requested state after running the configuration script and 143flushing the buffer cache. 144.Pp 145Actions can be configured for the following transitions: 146suspend, 147hibernate, 148standby, 149resume, 150powerup, 151and 152powerdown. 153The suspend, hibernate and standby actions are run prior to 154.Nm 155performing any other actions (such as disk syncs) and entering the new 156state. 157The resume program is run after resuming from a stand-by or 158suspended state. 159The powerup and powerdown programs are run after the power status (AC 160connected or not) changes, as well as after a resume (if the power 161status changed in the mean time). 162.Sh FILES 163.Bl -tag -width "/etc/apm/powerdownXX" -compact 164.It Pa /dev/apmctl 165Default device used to control the APM kernel driver. 166.Pp 167.It Pa /etc/apm/suspend 168.It Pa /etc/apm/hibernate 169.It Pa /etc/apm/standby 170.It Pa /etc/apm/resume 171.It Pa /etc/apm/powerup 172.It Pa /etc/apm/powerdown 173These files contain the host's customized actions. 174Each file must be an executable binary or shell script. 175A single program or script can be used to control all transitions 176by examining the name by which it was called, 177which is one of 178suspend, 179hibernate, 180standby, 181resume, 182powerup, 183or 184powerdown. 185.Pp 186.It Pa /var/run/apmdev 187Default 188.Ux Ns -domain 189socket used for communication with 190.Xr apm 8 . 191.El 192.Sh SEE ALSO 193.Xr syslog 3 , 194.Xr apm 4 , 195.Xr apm 8 , 196.Xr sysctl 8 197.Pp 198Advanced Power Management (APM) BIOS Interface Specification 199(revision 1.2), 200Intel Corporation and Microsoft Corporation. 201.Sh HISTORY 202The 203.Nm 204command first appeared in 205.Nx 1.3 . 206.Ox 207support was added in 208.Ox 1.2 . 209