APM(4) | Device Drivers Manual (loongson) | APM(4) |
apm
— advanced
power management device interface
apm0 at mainbus0
The apm
driver provides generic power and
battery control, relying on device specific drivers to provide the actual
information.
The apm
driver provides an interface which
simulates the Advanced Power Management (APM) BIOS functions encountered on
some x86 hardware. The BIOS functions are translated into the appropriate
microcontroller requests by the hardware specific drivers, like
ykbec(4). Currently only
battery level, AC connection, and charging status are available from the
apm
device. Suspend/resume and other power events
are not yet supported.
The apm
driver implements the following
ioctl(2) calls. They are
defined in
<machine/apmvar.h>
.
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
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.
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
EBUSY
.Suspend and resume are not supported.
February 27, 2016 | OpenBSD-6.4 |