apmd.8 (0227791b40a6936310e1dd376b0883b540fec0c0) | apmd.8 (d50a71bdd882717df3f41dadd84ffc28f3466a1a) |
---|---|
1.\" Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 2.\" Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp> 3.\" Copyright (c) 1999 Yoshihiko SARUMARU Aq <mistral@imasy.or.jp> 4.\" Copyright (c) 1999 Norihiro Kumagai <kuma@nk.rim.or.jp> 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" @(#)apmd.8 1.1 (FreeBSD) 6/28/99 | 1.\" Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 2.\" Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp> 3.\" Copyright (c) 1999 Yoshihiko SARUMARU Aq <mistral@imasy.or.jp> 4.\" Copyright (c) 1999 Norihiro Kumagai <kuma@nk.rim.or.jp> 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" @(#)apmd.8 1.1 (FreeBSD) 6/28/99 |
29.\" $FreeBSD$ | 29.\" $Id: apmd.8,v 1.1.1 1999/6/08 09:01:47 koie Exp % |
30.\" 31.Dd June 28, 1999 | 30.\" 31.Dd June 28, 1999 |
32.Dt APMD 8 i386 | 32.Dt APMD 8 |
33.Os 34.Sh NAME 35.Nm apmd 36.Nd Advanced Power Management monitor daemon 37.Sh SYNOPSIS | 33.Os 34.Sh NAME 35.Nm apmd 36.Nd Advanced Power Management monitor daemon 37.Sh SYNOPSIS |
38.Nm | 38.Nm apmd |
39.Op Fl d 40.Op Fl f file | 39.Op Fl d 40.Op Fl f file |
41.Op Fl s | |
42.Op Fl v 43.Sh DESCRIPTION | 41.Op Fl v 42.Sh DESCRIPTION |
44The 45.Nm 46utility | 43.Nm Apmd |
47monitors the occurrence of the specified Advanced Power Management | 44monitors the occurrence of the specified Advanced Power Management |
48.Pq Tn APM | 45.Pq APM |
49events and, if one of the events occurs, it executes the sequence of | 46events and, if one of the events occurs, it executes the sequence of |
50commands corresponding to the event. 51Only the events specified in the | 47commands corresponding to the event. Only the events specified in the |
52configuration file are notified to | 48configuration file are notified to |
53.Nm ; 54all other events are ignored. 55For each event posted by the APM BIOS, 56.Nm | 49.Nm apmd ; 50all other events are ignored. For each event posted by the APM BIOS, 51.Nm apmd |
57invokes the sequence of commands specified in the configuration file. 58When | 52invokes the sequence of commands specified in the configuration file. 53When |
59.Nm 60is running with monitoring suspend/standby requests, 61the kernel will not process those requests. | 54.Nm apmd 55is running with monitoring suspend/standby requests, 56the kernel will not process those requests. |
62Therefore, if you wish action to be taken when these events | 57Therefore, if you wish action to be taken when these events |
63occur, you need to explicitly configure the appropriate commands or | 58occur, you need to explicitly configure the appropriate commands or |
64built-in functions in the configuration file. 65.Pp | 59built-in functions in the configuration file. 60.Pp |
66The 67.Nm 68utility recognizes the following runtime options: | 61.Nm Apmd 62recognizes the following runtime options: |
69.Bl -tag -width -f_file 70.It Fl d | 63.Bl -tag -width -f_file 64.It Fl d |
71Starts in debug mode. 72This causes 73.Nm | 65Starts in debug mode. This causes 66.Nm apmd |
74to execute in the foreground instead of in daemon mode. 75.It Fl f Ar file 76Specifies a different configuration file 77.Ar file 78to be used in place of the default 79.Pa /etc/apmd.conf . | 67to execute in the foreground instead of in daemon mode. 68.It Fl f Ar file 69Specifies a different configuration file 70.Ar file 71to be used in place of the default 72.Pa /etc/apmd.conf . |
80.It Fl s 81Causes 82.Nm 83to simulate a POWERSTATECHANGE event when a power state change is detected 84(AC_POWER_STATE) but the bios of the laptop does not report it. 85This enables you to do things like dimming the LCD backlight when you unplug 86the power cord. | |
87.It Fl v 88Verbose mode. 89.El 90.Pp 91When | 73.It Fl v 74Verbose mode. 75.El 76.Pp 77When |
92.Nm | 78.Nm apmd |
93starts, it reads the configuration file | 79starts, it reads the configuration file |
94.Pa ( /etc/apmd.conf 95as default) | 80.Po 81.Pa /etc/apmd.conf 82as default 83.Pc |
96and notifies the set of events to be monitored to the APM device driver. 97When it terminates, the APM device driver automatically cancels 98monitored events. 99.Pp | 84and notifies the set of events to be monitored to the APM device driver. 85When it terminates, the APM device driver automatically cancels 86monitored events. 87.Pp |
100If the 101.Nm | 88If the 89.Nm apmd |
102process receives a SIGHUP, it will reread its configuration file and 103notify the APM device driver of any changes to its configuration. 104.Pp | 90process receives a SIGHUP, it will reread its configuration file and 91notify the APM device driver of any changes to its configuration. 92.Pp |
105The 106.Nm 107utility uses the device | 93.Nm Apmd 94uses the device |
108.Pa /dev/apmctl 109to issue 110.Xr ioctl 2 111requests for monitoring events and for controlling the APM system. 112This device file is opened exclusively, so only a single | 95.Pa /dev/apmctl 96to issue 97.Xr ioctl 2 98requests for monitoring events and for controlling the APM system. 99This device file is opened exclusively, so only a single |
113.Nm | 100.Nm apmd |
114process can be running at any time. 115.Pp | 101process can be running at any time. 102.Pp |
116When 117.Nm | 103When 104.Nm apmd |
118receives an APM event, it forks a child process to execute the 119commands specified in the configuration file and then continues | 105receives an APM event, it forks a child process to execute the 106commands specified in the configuration file and then continues |
120listening for more events. 121The child process executes the commands | 107listening for more events. The child process executes the commands |
122specified, one at a time and in the order that they are listed. 123.Pp | 108specified, one at a time and in the order that they are listed. 109.Pp |
124While 125.Nm | 110While 111.Nm apmd |
126is processing the command list for SUSPEND/STANDBY requests, the APM kernel 127device driver issues notifications to APM BIOS once per second so that the 128BIOS knows that there are still some commands pending, and that it should not 129complete the request just yet. 130.Pp 131The | 112is processing the command list for SUSPEND/STANDBY requests, the APM kernel 113device driver issues notifications to APM BIOS once per second so that the 114BIOS knows that there are still some commands pending, and that it should not 115complete the request just yet. 116.Pp 117The |
132.Nm 133utility creates the file | 118.Nm apmd 119daemon creates the file |
134.Pa /var/run/apmd.pid , 135and stores its process 136id there. 137This can be used to kill or reconfigure | 120.Pa /var/run/apmd.pid , 121and stores its process 122id there. 123This can be used to kill or reconfigure |
138.Nm . | 124.Nm apmd . |
139.Sh CONFIGURATION FILE 140The structure of the | 125.Sh CONFIGURATION FILE 126The structure of the |
141.Nm 142configuration file is quite simple. 143For example: | 127.Nm apmd 128configuration file is quite simple. For example: |
144.Pp 145.Bd -literal 146apm_event SUSPENDREQ { 147 exec "sync && sync && sync"; 148 exec "sleep 1"; 149 exec "zzz"; 150} 151.Ed 152.Pp 153will cause | 129.Pp 130.Bd -literal 131apm_event SUSPENDREQ { 132 exec "sync && sync && sync"; 133 exec "sleep 1"; 134 exec "zzz"; 135} 136.Ed 137.Pp 138will cause |
154.Nm 155to receive the APM event 156.Ql SUSPENDREQ | 139.Nm apmd 140to recieve the APM event 141.Ql SUSPENDREQ |
157(which may be posted by an LCD close), run the 158.Ql sync 159command 3 times and wait for a while, then execute | 142(which may be posted by an LCD close), run the 143.Ql sync 144command 3 times and wait for a while, then execute |
160.Nm zzz ( Ns Nm apm Fl z ) | 145.Nm zzz 146( 147.Nm apm 148.Fl z 149) |
161to put the system in the suspend state. 162.Pp 163.Bl -bullet 164.It | 150to put the system in the suspend state. 151.Pp 152.Bl -bullet 153.It |
165The apm_event keyword | 154The apm_event keyword |
166.Bd -ragged -offset indent 167.Ql apm_event 168is the keyword which indicates the start of configuration for 169each events. 170.Ed 171.It 172APM events 173.Bd -ragged -offset indent 174If you wish to execute the same commands for different events, the | 155.Bd -ragged -offset indent 156.Ql apm_event 157is the keyword which indicates the start of configuration for 158each events. 159.Ed 160.It 161APM events 162.Bd -ragged -offset indent 163If you wish to execute the same commands for different events, the |
175event names should be delimited by a comma. 176The following are | 164event names should be delimited by a comma. The following are |
177valid event names: 178.Bl -item 179.It 180- Events ignored by the kernel if | 165valid event names: 166.Bl -item 167.It 168- Events ignored by the kernel if |
181.Nm | 169.Nm apmd |
182is running: 183.Pp | 170is running: 171.Pp |
184.Bl -tag -width USERSUSPENDREQ -compact -offset indent | 172.Bl -tag -hang -width USERSUSPENDREQ -compact -offset indent |
185.It STANDBYREQ | 173.It STANDBYREQ |
186.It USERSTANDBYREQ | |
187.It SUSPENDREQ 188should include sync in the command list, 189.It USERSUSPENDREQ 190should include sync in the command list, 191.It BATTERYLOW 192only zzz should be specified in the command list. 193.El 194.It 195- Events passed to | 174.It SUSPENDREQ 175should include sync in the command list, 176.It USERSUSPENDREQ 177should include sync in the command list, 178.It BATTERYLOW 179only zzz should be specified in the command list. 180.El 181.It 182- Events passed to |
196.Nm | 183.Nm apmd |
197after kernel handling: 198.Pp | 184after kernel handling: 185.Pp |
199.Bl -tag -width USERSUSPENDREQ -compact -offset indent | 186.Bl -tag -hang -width USERSUSPENDREQ -compact -offset indent |
200.It NORMRESUME 201.It CRITRESUME 202.It STANDBYRESUME 203.It POWERSTATECHANGE 204.It UPDATETIME | 187.It NORMRESUME 188.It CRITRESUME 189.It STANDBYRESUME 190.It POWERSTATECHANGE 191.It UPDATETIME |
205.It CAPABILITIESCHANGE | |
206.El 207.Pp | 192.El 193.Pp |
208Other events will not be sent to 209.Nm . | 194Other events will not be sent to 195.Nm apmd . |
210.El 211.Ed 212.It 213command line syntax 214.Bd -ragged -offset indent | 196.El 197.Ed 198.It 199command line syntax 200.Bd -ragged -offset indent |
215In the example above, the three lines beginning with | 201In the example above, the three lines begining with |
216.Ql exec 217are commands for the event. | 202.Ql exec 203are commands for the event. |
218Each line should be terminated with a semicolon. | 204Each line should be terminated with a semicolon. |
219The command list for the event should be enclosed by 220.Ql { 221and 222.Ql } . | 205The command list for the event should be enclosed by 206.Ql { 207and 208.Ql } . |
223The 224.Nm 225utility uses | 209.Nm apmd 210uses |
226.Pa /bin/sh 227for double-quotation enclosed command execution, just as with 228.Xr system 3 . 229Each command is executed in order until the end of | 211.Pa /bin/sh 212for double-quotation enclosed command execution, just as with 213.Xr system 3 . 214Each command is executed in order until the end of |
230the list is reached or a command finishes with a non-zero status code. 231The 232.Nm 233utility will report any failed command's status code via 234.Xr syslog 3 | 215the list is reached or a command finishes with a non-zero status code. 216.Nm apmd 217will report any failed command's status code via 218.Xr syslog 3 |
235and will then reject the request event posted by the APM BIOS. 236.Ed 237.It 238Built-in functions 239.Bd -ragged -offset indent 240You can also specify | 219and will then reject the request event posted by the APM BIOS. 220.Ed 221.It 222Built-in functions 223.Bd -ragged -offset indent 224You can also specify |
241.Nm | 225.Nm apmd |
242built-in functions instead of command lines. 243A built-in function name should be terminated with a semicolon, 244just as with a command line. 245The following built-in functions are currently supported: 246.Bl -item 247.It 248- reject: 249.Bd -ragged -offset indent | 226built-in functions instead of command lines. 227A built-in function name should be terminated with a semicolon, 228just as with a command line. 229The following built-in functions are currently supported: 230.Bl -item 231.It 232- reject: 233.Bd -ragged -offset indent |
250Reject last request posted by APM BIOS. 251This can be used to reject | 234Reject last request posted by APM BIOS. This can be used to reject |
252a SUSPEND request when the LCD is closed and put the system in a 253STANDBY state instead. 254.Ed 255.El | 235a SUSPEND request when the LCD is closed and put the system in a 236STANDBY state instead. 237.Ed 238.El |
256.Ed | |
257.El | 239.El |
258.Sh FILES 259.Bl -tag -width /etc/apmd.conf -compact 260.It Pa /etc/apmd.conf 261.It Pa /dev/apmctl 262.It Pa /var/run/apmd.pid 263.El | |
264.Sh EXAMPLES 265Sample configuration commands include: 266.Bd -literal 267apm_event SUSPENDREQ { | 240.Sh EXAMPLES 241Sample configuration commands include: 242.Bd -literal 243apm_event SUSPENDREQ { |
268 exec "/etc/rc.suspend apm suspend"; | 244 exec "/etc/rc.suspend"; |
269} 270 271apm_event USERSUSPENDREQ { 272 exec "sync && sync && sync"; 273 exec "sleep 1"; 274 exec "apm -z"; 275} 276 | 245} 246 247apm_event USERSUSPENDREQ { 248 exec "sync && sync && sync"; 249 exec "sleep 1"; 250 exec "apm -z"; 251} 252 |
277apm_event NORMRESUME { 278 exec "/etc/rc.resume apm suspend"; | 253apm_event NORMRESUME, STANDBYRESUME { 254 exec "/etc/rc.resume"; |
279} 280 | 255} 256 |
281apm_event STANDBYRESUME { 282 exec "/etc/rc.resume apm standby"; 283} 284 | |
285# resume event configuration for serial mouse users by 286# reinitializing a moused(8) connected to a serial port. 287# 288#apm_event NORMRESUME { 289# exec "kill -HUP `cat /var/run/moused.pid`"; 290#} 291# 292# suspend request event configuration for ATA HDD users: 293# execute standby instead of suspend. 294# 295#apm_event SUSPENDREQ { 296# reject; 297# exec "sync && sync && sync"; 298# exec "sleep 1"; 299# exec "apm -Z"; 300#} 301.Ed | 257# resume event configuration for serial mouse users by 258# reinitializing a moused(8) connected to a serial port. 259# 260#apm_event NORMRESUME { 261# exec "kill -HUP `cat /var/run/moused.pid`"; 262#} 263# 264# suspend request event configuration for ATA HDD users: 265# execute standby instead of suspend. 266# 267#apm_event SUSPENDREQ { 268# reject; 269# exec "sync && sync && sync"; 270# exec "sleep 1"; 271# exec "apm -Z"; 272#} 273.Ed |
274.Sh FILES 275.Bl -tag -width /etc/apmd.conf -compact 276.It Pa /etc/apmd.conf 277.It Pa /dev/apmctl 278.It Pa /var/run/apmd.pid 279.El |
|
302.Sh SEE ALSO 303.Xr apm 4 , | 280.Sh SEE ALSO 281.Xr apm 4 , |
304.Xr apm 8 305.Sh HISTORY 306The 307.Nm 308utility appeared in 309.Fx 3.3 . | 282.Xr apm 8 , 283.Xr apmconf 8 |
310.Sh AUTHORS 311.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org 312.An KOIE Hidetaka Aq koie@suri.co.jp 313.Pp | 284.Sh AUTHORS 285.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org 286.An KOIE Hidetaka Aq koie@suri.co.jp 287.Pp |
314.An -nosplit | |
315Some contributions made by 316.An Warner Losh Aq imp@FreeBSD.org , 317.An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp , 318.An Yoshihiko SARUMARU Aq mistral@imasy.or.jp , 319.An Norihiro Kumagai Aq kuma@nk.rim.or.jp , 320.An NAKAGAWA Yoshihisa Aq nakagawa@jp.FreeBSD.org , 321and 322.An Nick Hilliard Aq nick@foobar.org . | 288Some contributions made by 289.An Warner Losh Aq imp@FreeBSD.org , 290.An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp , 291.An Yoshihiko SARUMARU Aq mistral@imasy.or.jp , 292.An Norihiro Kumagai Aq kuma@nk.rim.or.jp , 293.An NAKAGAWA Yoshihisa Aq nakagawa@jp.FreeBSD.org , 294and 295.An Nick Hilliard Aq nick@foobar.org . |
296.Sh HISTORY 297The 298.Nm apmd 299command appeared in 300.Fx 4.0 . |
|