Chrome OS Power Management udev Usage

Warning: This document is old & has moved. Please update any links:
https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/power_manager/docs/udev.md

powerd uses the udev interface to learn about hardware changes.

Inhibiting and configuring wakeup for input devices

The InputDeviceController class is responsible for setting input devices' inhibit udev system attributes (to suppress events) and wakeup sysfs attributes (to enable or disable their ability to wake the system) appropriately depending on the system's current mode. For example, the touchscreen should be ignored while the system is in docked mode with its lid closed.

This behavior is configured via udev tags that are set on devices by the 90-power-id.rules and 92-powerd-tags.rules files:

TagDescription
inhibitIf set, powerd will inhibit the device when not usable
usable_when_dockedDevice is usable when system is docked
usable_when_display_offDevice is usable when in clamshell mode with display off
usable_when_laptopDevice is usable when in clamshell mode
usable_when_tabletDevice is usable when in tablet mode
wakeupIf set, powerd will manage the device's wakeup attribute
wakeup_when_dockedEnable wakeup when system is docked
wakeup_when_display_offEnable wakeup when in clamshell mode with display off
wakeup_when_laptopEnable wakeup when in clamshell mode
wakeup_when_tabletEnable wakeup when in tablet mode
wakeup_only_when_usableShorthand for enabling wakeup only when usable
wakeup_disabledUnconditionally disable wakeup (if wakeup is also set)

If only the wakeup tag is set, wakeup will be unconditionally enabled. If one or more wakeup_when_* tags are also present, wakeup will be enabled only while in the requested modes.

Boards can create and install their own udev rules with prefix 91- to override generic internal/external_[type] roles, or create udev rules with prefix 93- to override the specific tags above.