xref: /openbsd-src/share/man/man4/man4.macppc/apm.4 (revision 61230bc727b89ebdd7816f24b4e5329ec556bc20)
1.\"	$OpenBSD: apm.4,v 1.17 2023/01/30 14:43:29 jcs Exp $
2.\"
3.\"	Copyright (c) 1998 Marco S. Hyman
4.\"
5.\"	Permission to copy all or part of this material for any purpose is
6.\"	granted provided that the above copyright notice and this paragraph
7.\"	are duplicated in all copies.  THIS SOFTWARE IS PROVIDED ``AS IS''
8.\"	AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
9.\"	LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
10.\"	FOR A PARTICULAR PURPOSE.
11.\"
12.Dd $Mdocdate: January 30 2023 $
13.Dt APM 4 macppc
14.Os
15.Sh NAME
16.Nm apm
17.Nd advanced power management device interface
18.Sh SYNOPSIS
19.Cd "apm0 at adb?"
20.Sh DESCRIPTION
21The
22.Nm
23driver provides an interface which simulates the Advanced Power Management
24.Pq APM
25BIOS functions.
26The BIOS functions are translated into the appropriate PowerManager requests.
27Currently only battery level, AC connection, and charging status is available
28from the
29.Nm
30device.
31.Pp
32Suspend/resume and other power events are
33.Em NOT YET SUPPORTED .
34.Pp
35Configuration options:
36.Pp
37.Bl -tag -width DIAGNOSTIC -compact -offset indent
38.It Dv APMDEBUG
39Enable various driver status messages.
40.It Dv DIAGNOSTIC
41Enable debugging messages.
42.It Dv DEBUG
43Enable other debugging messages.
44.El
45.Pp
46The
47.Nm
48driver implements the following
49.Xr ioctl 2
50calls.
51They are defined in
52.In machine/apmvar.h .
53.Bl -tag -width Ds
54.It Dv APM_IOC_REJECT
55.Em Not implemented . DO NOT USE .
56.It Dv APM_IOC_STANDBY
57.Em NOT YET SUPPORTED on macppc .
58.Pp
59.Pq Li "no parameters"
60Request
61.Dq standby
62mode.
63.It Dv APM_IOC_SUSPEND
64.Em NOT YET SUPPORTED on macppc .
65.Pp
66.Pq Li "no parameters"
67Request
68.Dq suspend
69mode.
70.\" .It Dv APM_IOC_HIBERNATE
71.\" .Em NOT YET SUPPORTED on macppc .
72.\" .Pp
73.\" .Pq Li "no parameters"
74.\" Request
75.\" .Dq hibernate
76.\" mode.
77.It Dv APM_IOC_GETPOWER
78.Pq Li "struct apm_power_info"
79Request the current power state.
80The argument structure is as follows:
81.Bd -literal -offset indent
82struct apm_power_info {
83	u_char battery_state;
84	u_char ac_state;
85	u_char battery_life;
86	u_char spare1;
87	u_int minutes_left;
88	u_int spare2[6];
89};
90.Ed
91.Pp
92The following values are defined for
93.Va battery_state :
94.Bl -tag -width Ds
95.It Dv APM_BATT_HIGH
96Battery has a high state of charge.
97.It Dv APM_BATT_LOW
98Battery has a low state of charge.
99.It Dv APM_BATT_CRITICAL
100Battery has a critical state of charge.
101.It Dv APM_BATT_CHARGING
102Battery is not high, low, or critical and is currently charging.
103.It Dv APM_BATT_UNKNOWN
104Cannot read the current battery state.
105.It Dv APM_BATTERY_ABSENT
106No battery installed.
107.El
108.Pp
109The following values are defined for
110.Va ac_state :
111.Bl -tag -width Ds
112.It Dv APM_AC_OFF
113External power not detected.
114.It Dv APM_AC_ON
115External power detected.
116.It Dv APM_AC_BACKUP
117Backup power in use.
118.It Dv APM_AC_UNKNOWN
119External power state unknown.
120.El
121.Pp
122The
123.Va battery_life
124value contains the estimated percentage of battery life available.
125100% indicates a full charge.
126.Pp
127If the battery is charging, i.e. when
128.Va battery_state
129is equal to
130.Dv APM_BATT_CHARGING ,
131the
132.Va battery_life
133value contains the estimated number of minutes until the battery will be
134fully charged.
135Otherwise, the
136.Va minutes_left
137value contains the estimated number of minutes of battery life remaining.
138.It Dv APM_IOC_DEV_CTL
139.Em NOT YET SUPPORTED on macppc .
140.Pp
141.Pq Li "struct apm_ctl"
142Allows an application to directly set the
143APM operating mode.
144The argument structure is as follows:
145.Bd -literal -offset indent
146struct apm_ctl {
147	u_int dev;
148	u_int mode;
149};
150.Ed
151.Pp
152.Va dev
153indicates the device, typically
154.Dv APM_DEV_ALLDEVS .
155.Pp
156.Va mode
157indicates the desired operating mode.
158Possible values are
159.Bl -tag -width Ds -compact -offset indent
160.It Dv APM_SYS_READY
161.It Dv APM_SYS_STANDBY
162.It Dv APM_SYS_SUSPEND
163.It Dv APM_SYS_OFF
164.It Dv APM_LASTREQ_INPROG
165.It Dv APM_LASTREQ_REJECTED
166.El
167.It Dv APM_IOC_PRN_CTL
168.Em NOT YET SUPPORTED on macppc .
169.Pp
170.Pq Li "int"
171This
172.Xr ioctl 2
173controls message output by the APM
174driver when a power change event is detected.
175The integer parameter is one of:
176.Bl -tag -width Ds
177.It Dv APM_PRINT_ON
178All power change events result in a message.
179This is the normal operating mode for the driver.
180.It Dv APM_PRINT_OFF
181Power change event messages are suppressed.
182.It Dv APM_PRINT_PCT
183Power change event messages are suppressed unless the estimated
184battery life percentage changes.
185.El
186.El
187.Sh FILES
188.Bl -tag -width "/dev/apmctlXXX"
189.It /dev/apm
190Power management data device.
191May only be opened read-only.
192May be opened by multiple concurrent users.
193.It /dev/apmctl
194Power management control device.
195May be opened read-write or write-only.
196May only be opened by one user at a time.
197An attempt to open the file when in use will fail, returning
198.Er EBUSY .
199.El
200.Sh SEE ALSO
201.Xr adb 4 ,
202.Xr intro 4 ,
203.Xr apm 8 ,
204.Xr apmd 8 ,
205.Xr halt 8
206.Sh HISTORY
207The
208.Nm
209driver source code contains these copyrights:
210.Pp
211.Bl -item -compact
212.It
213.Li Copyright (c) 1995 John T. Kohl.  All rights reserved.
214.It
215.Li Copyright (C) 1994 by HOSOKAWA Tatsumi <hosokawa@mt.cs.keio.ac.jp>
216.El
217.Pp
218\&...and has been hacked on by many others since.
219.Sh BUGS
220Sleep modes and power events are not supported.
221