Busybox acpid

From Alpine Linux
Revision as of 23:55, 24 August 2023 by Sertonix (talk | contribs) (add power management category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Busybox acpid allows custom mapping and handling of ACPI events via options -M FILE (Map file) and -a FILE (Action file).

Map file

A Map file maps ACPI events to descriptions (the last column). For example:

Contents of /etc/acpi.map

"EV_KEY" 0x01 "KEY_POWER" 116 1 "button/power PWRF 00000080" "EV_KEY" 0x01 "KEY_POWER" 116 1 "button/power PWRB 00000080" "EV_KEY" 0x01 "KEY_SLEEP" 142 1 "button/sleep SBTN 00000080" "EV_KEY" 0x01 "KEY_SUSPEND" 205 1 "button/suspend SUSP 00000080" "EV_SW" 0x05 "SW_LID" 0 0 "button/lid LID/open 00000080 00000000" "EV_SW" 0x05 "SW_LID" 0 1 "button/lid LID/close 00000080 00000001" "EV_SW" 0x05 "SW_TABLET_MODE" 1 0 "video/tabletmode TBLT/off 0000008A 00000000" "EV_SW" 0x05 "SW_TABLET_MODE" 1 1 "video/tabletmode TBLT/on 0000008A 00000001"

The built-in map file contains only PWRB/PWRF (power button) and LID (lid close).

Action file

An Action file maps the event descriptions specified in the Map file to action scripts relative to the Config directory (/etc/acpi by default). It performs a substring match, so typically only the second part of the description is specified in the Action file. If the target path is not a file, but directory, it executes all scripts in the directory via run-parts. For example:

Contents of /etc/acpid.conf

PWRF power SBTN sleep SUSP suspend LID/open lid/open LID/close lid/close TBLT/off tabletmode/off TBLT/on tabletmode/on

When the power button is pressed, acpid runs script /etc/acpi/power.

Resources