Documentation
¶
Overview ¶
Package apm allows users to query OpenBSD's power management system.
Index ¶
Constants ¶
View Source
const ApmIOCGetPower = 0x40204103
View Source
const ApmIOCStandby = 0x20004102
View Source
const ApmIOCSuspend = 0x20004102
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApmPowerInfo ¶
type ApmPowerInfo struct { Battery_state uint8 Ac_state uint8 Battery_life uint8 Spare1 uint8 Minutes_left uint32 Spare2 [6]uint32 }
func NewPwrInfo ¶
func NewPwrInfo() (*ApmPowerInfo, error)
NewPwrInfo returns an ApmPowerInfo instance, prepopulated with the current state.
func (*ApmPowerInfo) Charging ¶
func (a *ApmPowerInfo) Charging() bool
Charging returns true of the device is actively charging.
func (*ApmPowerInfo) Get ¶
func (a *ApmPowerInfo) Get() error
Get queries the system for power information.
func (*ApmPowerInfo) HasBatt ¶
func (a *ApmPowerInfo) HasBatt() bool
HasBatt returns true if the state is any state but '4'. 4 explicitly means a battery is absent. See https://man.openbsd.org/man8/amd64/apm.8 for more information.
Click to show internal directories.
Click to hide internal directories.