APM(4) | Device Drivers Manual (zaurus) | APM(4) |
apm
— advanced
power management device interface
apm0 at pxaip?
The apm
driver provides an interface which
simulates the Advanced Power Management (APM) BIOS functions. The BIOS
functions are translated into the appropriate Power Manager requests.
Currently only battery level, AC connection, and charging status is
available from the apm
device, and no distinction is
made between standby and suspend requests. Other power events are
NOT YET SUPPORTED.
Configuration options:
APMDEBUG
DIAGNOSTIC
DEBUG
The apm
driver implements the following
ioctl(2) calls. They are
defined in
<machine/apmvar.h>
.
APM_IOC_REJECT
struct apm_event_info
)
Not
implemented.
DO NOT
USE.APM_IOC_STANDBY
no parameters
) Request “standby”
mode.APM_IOC_SUSPEND
no parameters
) Request “suspend”
mode.APM_IOC_GETPOWER
struct apm_power_info
) Request the current power
state. The argument structure is as follows:
struct apm_power_info { u_char battery_state; u_char ac_state; u_char battery_life; u_char spare1; u_int minutes_left; u_int spare2[6]; };
The following values are defined for battery_state:
APM_BATT_HIGH
APM_BATT_LOW
APM_BATT_CRITICAL
APM_BATT_CHARGING
APM_BATT_UNKNOWN
APM_BATTERY_ABSENT
The following values are defined for ac_state:
APM_AC_OFF
APM_AC_ON
APM_AC_BACKUP
APM_AC_UNKNOWN
The battery_life value contains the estimated percentage of battery life available. 100% indicates a full charge.
The minutes_left value contains the estimated number of minutes of battery life remaining. If no time estimate is available, the minutes_left value is 0.
APM_IOC_NEXTEVENT
struct apm_event_info
) The APM
driver stores up to APM_NEVENTS
events. This was
defined as 16 at the time this documentation was written. If the event
list is full when a new event is detected the new event is lost.
APM_IOC_NEXTEVENT
ioctl returns the next event on
the list or EAGAIN
if the event list is empty. The
format of the returned event is:
struct apm_event_info { u_int type; u_int index; u_int spare[8]; };
APM_IOC_DEV_CTL
struct apm_ctl
)
Allows an application to directly set the APM operating mode. The argument
structure is as follows:
struct apm_ctl { u_int dev; u_int mode; };
dev indicates the device, typically
APM_DEV_ALLDEVS
.
mode indicates the desired operating mode. Possible values are
APM_IOC_PRN_CTL
int
) This
ioctl(2) controls message
output by the APM driver when a power change event is detected. The
integer parameter is one of:
APM_PRINT_ON
APM_PRINT_OFF
APM_PRINT_PCT
However, in no case will power status messages be displayed
until the battery life goes below the percentage in the
sysctl(8) state variable
machdep.apmwarn
. Setting
machdep.apmwarn
to zero disables all warnings
regardless of the APM_IOC_PRN_CTL
setting.
EBUSY
.intro(4), sysctl.conf(5), apm(8), apmd(8), halt(8), sysctl(8)
Power events are not supported.
Reported battery life remaining and minutes left can be off by 25% or more, and are generally overestimated while the battery is charging.
February 27, 2016 | OpenBSD-6.0 |