1*4e6fd04bSjmc.\" $OpenBSD: apmd.8,v 1.55 2022/05/28 16:07:54 jmc Exp $ 2a831c31eSmickey.\" 3054c7b81Shvozda.\" Copyright (c) 1995 John T. Kohl 4054c7b81Shvozda.\" All rights reserved. 5054c7b81Shvozda.\" 6054c7b81Shvozda.\" Redistribution and use in source and binary forms, with or without 7054c7b81Shvozda.\" modification, are permitted provided that the following conditions 8054c7b81Shvozda.\" are met: 9054c7b81Shvozda.\" 1. Redistributions of source code must retain the above copyright 10054c7b81Shvozda.\" notice, this list of conditions and the following disclaimer. 11054c7b81Shvozda.\" 2. Redistributions in binary form must reproduce the above copyright 12054c7b81Shvozda.\" notice, this list of conditions and the following disclaimer in the 13054c7b81Shvozda.\" documentation and/or other materials provided with the distribution. 14054c7b81Shvozda.\" 3. The name of the author may not be used to endorse or promote products 15054c7b81Shvozda.\" derived from this software without specific prior written permission. 16054c7b81Shvozda.\" 17054c7b81Shvozda.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 18054c7b81Shvozda.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19054c7b81Shvozda.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20054c7b81Shvozda.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 21054c7b81Shvozda.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22054c7b81Shvozda.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23054c7b81Shvozda.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24054c7b81Shvozda.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25054c7b81Shvozda.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 26054c7b81Shvozda.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27054c7b81Shvozda.\" POSSIBILITY OF SUCH DAMAGE. 28054c7b81Shvozda.\" 29*4e6fd04bSjmc.Dd $Mdocdate: May 28 2022 $ 30054c7b81Shvozda.Dt APMD 8 31fc8533a3Saaron.Os 32054c7b81Shvozda.Sh NAME 33054c7b81Shvozda.Nm apmd 34fb66e48eSjmc.Nd Advanced Power Management daemon 35054c7b81Shvozda.Sh SYNOPSIS 367349792aSaaron.Nm apmd 376149d02eStedu.Op Fl AadHLs 38054c7b81Shvozda.Op Fl f Ar devname 39275e7134Smickey.Op Fl S Ar sockname 40275e7134Smickey.Op Fl t Ar seconds 4195c85f17Stedu.Op Fl Z Ar percent 4295c85f17Stedu.Op Fl z Ar percent 43054c7b81Shvozda.Sh DESCRIPTION 44054c7b81Shvozda.Nm 45fb66e48eSjmcmonitors the advanced power management device, 46fb66e48eSjmc.Xr apm 4 , 47fb66e48eSjmcacting on signaled events and upon user requests as sent by the 48054c7b81Shvozda.Xr apm 8 49054c7b81Shvozdaprogram. 50fb66e48eSjmc.Pp 51054c7b81ShvozdaFor suspend and standby request events delivered by the BIOS, or via 52054c7b81Shvozda.Xr apm 8 , 53054c7b81Shvozda.Nm 54054c7b81Shvozdaruns the appropriate configuration program (if one exists), 55a99a7ef6Ssturmsyncs the buffer cache to disk and initiates the requested state. 56054c7b81ShvozdaWhen resuming after suspend or standby, 57054c7b81Shvozda.Nm 58054c7b81Shvozdaruns the appropriate configuration program (if one exists). 590a306e50Sjmc.Pp 600a306e50SjmcWhen the power status changes 61*4e6fd04bSjmc(external power is connected or disconnected), 62054c7b81Shvozda.Nm 63054c7b81Shvozdafetches the current status and reports it via 64054c7b81Shvozda.Xr syslog 3 65054c7b81Shvozdawith logging facility 66054c7b81Shvozda.Dv LOG_DAEMON . 67054c7b81Shvozda.Pp 68a9462322SjmcThe options are as follows: 69a9462322Sjmc.Bl -tag -width Ds 70f6da2e61Ssturm.It Fl A 71f6da2e61SsturmStart 72f6da2e61Ssturm.Nm 73dc2bea8aSjmcin automatic performance adjustment mode (the default). 74a9462322Sjmc.It Fl a 75a9462322SjmcBIOS-initiated suspend or standby requests are 76054c7b81Shvozdaignored if the system is connected to line current and not running from 77054c7b81Shvozdabatteries (user requests are still honored). 78a9462322Sjmc.It Fl d 79054c7b81Shvozda.Nm 802a1df9f6Steduenters debug mode, staying in the foreground. 8125276569SjcaLogging output is printed to stderr. 82a9462322Sjmc.It Fl f Ar devname 83a9462322SjmcSpecify an alternate device file name, 84a9462322Sjmc.Ar devname . 85f6da2e61Ssturm.It Fl H 86f6da2e61SsturmStart 87f6da2e61Ssturm.Nm 88a99a7ef6Ssturmin manual performance adjustment mode, initialising 89f6da2e61Ssturm.Va hw.setperf 90f6da2e61Ssturmto 100. 91f6da2e61Ssturm.It Fl L 92f6da2e61SsturmStart 93f6da2e61Ssturm.Nm 94a99a7ef6Ssturmin manual performance adjustment mode, initialising 95f6da2e61Ssturm.Va hw.setperf 96f6da2e61Ssturmto 0. 97a9462322Sjmc.It Fl S Ar sockname 98a9462322SjmcSpecify an alternate socket name, 99a9462322Sjmc.Ar sockname . 100a9462322SjmcThe socket is protected to mode 0660, UID 0, GID 0; this protects access 101a9462322Sjmcto suspend requests to authorized users only. 102a9462322Sjmc.It Fl s 103a9462322SjmcCurrent battery statistics are reported via 104a9462322Sjmc.Xr syslog 3 105a9462322Sjmcand 106a9462322Sjmc.Nm 107a9462322Sjmcexits without monitoring the APM status. 108a9462322Sjmc.It Fl t Ar seconds 109a9462322Sjmc.Nm 110a9462322Sjmcperiodically polls the APM driver for the current power state. 111a9462322SjmcIf the battery charge level changes substantially or the external power 112a9462322Sjmcstatus changes, the new status is logged. 113a9462322SjmcThe polling rate defaults to 114a9462322Sjmconce per 10 minutes, but may be specified using the 115a9462322Sjmc.Fl t 116a9462322Sjmccommand-line flag. 11795c85f17Stedu.It Fl Z Ar percent 11895c85f17SteduAutomatically hibernate the system if no AC is connected and the 11995c85f17Steduestimated battery life is equal or below 12095c85f17Stedu.Ar percent . 12195c85f17Stedu.It Fl z Ar percent 12295c85f17SteduAutomatically suspend the system if no AC is connected and the 12395c85f17Steduestimated battery life is equal or below 12495c85f17Stedu.Ar percent . 12595c85f17Stedu.Pp 12695c85f17SteduIf both 12795c85f17Stedu.Fl Z 12895c85f17Steduand 12995c85f17Stedu.Fl z 13095c85f17Steduare specified, the last one will supersede the other. 13132fd24c3SjcaAfter a resume, the effect of those options is inhibited for 60 seconds. 132a9462322Sjmc.El 133bea40608Smarc.Pp 134a99a7ef6SsturmWhen a client requests a suspend or stand-by state, 135054c7b81Shvozda.Nm 136054c7b81Shvozdadoes not wait for positive confirmation that the requested 137a99a7ef6Ssturmstate has been entered before replying to the client; to do so would mean 138054c7b81Shvozdathe client does not get a reply until the system resumes from its sleep state. 139054c7b81ShvozdaRather, 140054c7b81Shvozda.Nm 141054c7b81Shvozdareplies with the intended state to the client and then places the system 142a99a7ef6Ssturmin the requested state after running the configuration script and 143054c7b81Shvozdaflushing the buffer cache. 144054c7b81Shvozda.Pp 145231aaf50SdcoppaActions can be configured for the following transitions: 1460a306e50Sjmcsuspend, 147231aaf50Sdcoppahibernate, 1480a306e50Sjmcstandby, 1490a306e50Sjmcresume, 1500a306e50Sjmcpowerup, 151054c7b81Shvozdaand 1520a306e50Sjmcpowerdown. 153231aaf50SdcoppaThe suspend, hibernate and standby actions are run prior to 154054c7b81Shvozda.Nm 155054c7b81Shvozdaperforming any other actions (such as disk syncs) and entering the new 156a99a7ef6Ssturmstate. 157cdbdb68aSaaronThe resume program is run after resuming from a stand-by or 158054c7b81Shvozdasuspended state. 159a831c31eSmickeyThe powerup and powerdown programs are run after the power status (AC 160a831c31eSmickeyconnected or not) changes, as well as after a resume (if the power 161a831c31eSmickeystatus changed in the mean time). 162054c7b81Shvozda.Sh FILES 163a9462322Sjmc.Bl -tag -width "/etc/apm/powerdownXX" -compact 1643139dd70Sschwarze.It Pa /dev/apmctl 165a9462322SjmcDefault device used to control the APM kernel driver. 166a9462322Sjmc.Pp 1673139dd70Sschwarze.It Pa /etc/apm/suspend 1683139dd70Sschwarze.It Pa /etc/apm/hibernate 1693139dd70Sschwarze.It Pa /etc/apm/standby 1703139dd70Sschwarze.It Pa /etc/apm/resume 1713139dd70Sschwarze.It Pa /etc/apm/powerup 1723139dd70Sschwarze.It Pa /etc/apm/powerdown 173a9462322SjmcThese files contain the host's customized actions. 1740a306e50SjmcEach file must be an executable binary or shell script. 1750a306e50SjmcA single program or script can be used to control all transitions 176aa53b5b4Sjmcby examining the name by which it was called, 177aa53b5b4Sjmcwhich is one of 1780a306e50Sjmcsuspend, 179231aaf50Sdcoppahibernate, 1800a306e50Sjmcstandby, 1810a306e50Sjmcresume, 1820a306e50Sjmcpowerup, 183a9462322Sjmcor 1840a306e50Sjmcpowerdown. 185054c7b81Shvozda.Pp 1863139dd70Sschwarze.It Pa /var/run/apmdev 187d9f1e411SsobradoDefault 188f829369eSsobrado.Ux Ns -domain 189f829369eSsobradosocket used for communication with 190054c7b81Shvozda.Xr apm 8 . 191a9462322Sjmc.El 192054c7b81Shvozda.Sh SEE ALSO 193054c7b81Shvozda.Xr syslog 3 , 1941ad7c21cSmarc.Xr apm 4 , 1951ad7c21cSmarc.Xr apm 8 , 1960a306e50Sjmc.Xr sysctl 8 197a9462322Sjmc.Pp 198a9462322SjmcAdvanced Power Management (APM) BIOS Interface Specification 199a9462322Sjmc(revision 1.2), 200a9462322SjmcIntel Corporation and Microsoft Corporation. 201054c7b81Shvozda.Sh HISTORY 202054c7b81ShvozdaThe 2031ad7c21cSmarc.Nm 204a9462322Sjmccommand first appeared in 205e7f8c597Spjanzen.Nx 1.3 . 206f85b861aSjasoni.Ox 207f85b861aSjasonisupport was added in 20815fb2f05Smickey.Ox 1.2 . 209