The Chromium OS power manager consists of several components:
- powerd: user-space daemon running as the "power" user that initiates dimming the screen, suspending the system, etc.
- powerd_setuid_helper: setuid root binary used by powerd to perform actions requiring additional privileges.
- powerd_dbus_suspend: shell script executed by powerd (by way of powerd_setuid_helper) to suspend and resume the system.
- send_metrics_on_resume: shell script executed by powerd_suspend and by the send-boot-metrics Upstart job to report suspend-related metrics.
Changing power management timeouts for development or testing
There are several different techniques that can be used to temporarily override the power manager's default behavior:
- set_power_policy: This utility program was added in R26 to exercise the code path that Chrome uses to override the default power management policy (which was needed for enterprise). Run it with --help to see the available fields or without any arguments to restore the default policy. Note that Chrome may override any policy that you manually set; this happens when the related Chrome preferences are changed or when Chrome is restarted, for instance.
- powerd preferences: powerd's default preferences are stored on the read-only partition in /usr/share/power_manager. These preferences can be overridden by identically-named files on the stateful partition in /var/lib/power_manager. In most cases, preference changes won't take effect until the powerd process is restarted. The set_short_powerd_timeouts script can be used to quickly set inactivity timeouts to low values and restart powerd.
Triggering a suspend manually
The powerd_dbus_suspend program can be run from crosh or an SSH session to exercise the normal suspend path; it sends a D-Bus message to powerd asking it to suspend the system. See also memory_suspend_test and suspend_stress_test.
Disabling automatic sleep via Chrome Extensions
There is a Keep Awake Extension available. Once installed and enabled, it will keep the system from automatically sleeping in response to user activity.
Check out the chrome.power extension API documentation for more details.
Doing work before the system suspends or after it resumes