Skip to main content

Module power

Module power 

Source
Expand description

System power device contract (/devices/power, kind b'P').

The device performs hardware power actions only. It does not coordinate an OS shutdown: the lifecycle subsystem stops tasks and commits storage first, then calls this device as its final step. Hosts restrict the node to privileged users through VFS permissions.

NumberCommandDirectionInputOutputEffect
0x00GET_CAPABILITIESRead()u8Bit set of Capabilities.
0x01POWER_OFFWriteu8()Halt or power off; input: exit status.
0x02RESTARTWriteu8()Reset or restart; input: exit status.
0x03SLEEPWrite()()Enter a low-power state it resumes from.

The exit status is meaningful only to hosted targets (process exit code). An unsupported action fails with Unsupported; a successful action may never return. Payloads are plain bytes.

Structsยง

Capabilities
Bit set of power actions a target really performs.
GET_CAPABILITIES
POWER_OFF
RESTART
SLEEP