APM(4) - Device Drivers Manual (macppc)

APM(4) - Device Drivers Manual (macppc) #

APM(4) - Device Drivers Manual (macppc)

NAME #

apm - advanced power management device interface

SYNOPSIS #

apm0 at adb?

DESCRIPTION #

The apm driver provides an interface which simulates the Advanced Power Management (APM) BIOS functions. The BIOS functions are translated into the appropriate PowerManager requests. Currently only battery level, AC connection, and charging status is available from the apm device.

Suspend/resume and other power events are NOT YET SUPPORTED.

Configuration options:

APMDEBUG

Enable various driver status messages.

DIAGNOSTIC

Enable debugging messages.

DEBUG

Enable other debugging messages.

The apm driver implements the following ioctl(2) calls. They are defined in <machine/apmvar.h>.

APM_IOC_REJECT

Not implemented. DO NOT USE.

APM_IOC_STANDBY

NOT YET SUPPORTED on macppc.

(no parameters) Request “standby” mode.

APM_IOC_SUSPEND

NOT YET SUPPORTED on macppc.

(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

Battery has a high state of charge.

APM_BATT_LOW

Battery has a low state of charge.

APM_BATT_CRITICAL

Battery has a critical state of charge.

APM_BATT_CHARGING

Battery is not high, low, or critical and is currently charging.

APM_BATT_UNKNOWN

Cannot read the current battery state.

APM_BATTERY_ABSENT

No battery installed.

The following values are defined for ac_state:

APM_AC_OFF

External power not detected.

APM_AC_ON

External power detected.

APM_AC_BACKUP

Backup power in use.

APM_AC_UNKNOWN

External power state unknown.

The battery_life value contains the estimated percentage of battery life available. 100% indicates a full charge.

If the battery is charging, i.e. when battery_state is equal to APM_BATT_CHARGING, the battery_life value contains the estimated number of minutes until the battery will be fully charged. Otherwise, the minutes_left value contains the estimated number of minutes of battery life remaining.

APM_IOC_DEV_CTL

NOT YET SUPPORTED on macppc.

(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_SYS_READY

APM_SYS_STANDBY

APM_SYS_SUSPEND

APM_SYS_OFF

APM_LASTREQ_INPROG

APM_LASTREQ_REJECTED

APM_IOC_PRN_CTL

NOT YET SUPPORTED on macppc.

(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

All power change events result in a message. This is the normal operating mode for the driver.

APM_PRINT_OFF

Power change event messages are suppressed.

APM_PRINT_PCT

Power change event messages are suppressed unless the estimated battery life percentage changes.

FILES #

/dev/apm

Power management data device. May only be opened read-only. May be opened by multiple concurrent users.

/dev/apmctl

Power management control device. May be opened read-write or write-only. May only be opened by one user at a time. An attempt to open the file when in use will fail, returning EBUSY.

SEE ALSO #

adb(4), intro(4), apm(8), apmd(8), halt(8)

HISTORY #

The apm driver source code contains these copyrights:

Copyright (c) 1995 John T. Kohl. All rights reserved.
Copyright (C) 1994 by HOSOKAWA Tatsumi <hosokawa@mt.cs.keio.ac.jp>

…and has been hacked on by many others since.

BUGS #

Sleep modes and power events are not supported.

OpenBSD 7.5 - January 30, 2023