Apmd

Apm and apmd are OpenBSD's tools for handling power saving and managing acpi/apm. While it's not very useful for servers, it's sometimes handy to use in laptops or SBCs, which power management is important.

Configuration

Since it's included in default installation in OpenBSD, you don't need installing it. Using some of following examples require Apmd running, but not all of them:

$ doas rcctl enable apmd
$ doas rcctl start apmd

Usage

To show current battery and if we are connected to power:

$ apm

To make it easier for scripts, -l and -m could be used, they show battery in % and minutes. Note that if device is getting charged, -m shows time left to battery be completely charged.

$ apm -l # in %
$ apm -m # in mins

To take the system to S3 power state (aka suspend or sleep):

$ apm -z

or alternatively

$ zzz

To hibernate system:

$ apm -Z

or alternatively

$ ZZZ

Hibernating system requires a swap partition to be activated.

To set power saving mode on:

$ apm -L

and performance mode on:

$ apm -H

There is an also automatic mode, which sets cpu's power usage based on workload, the default when apmd is enabled:

$ apm -A