Chromium OS‎ > ‎packages‎ > ‎

Power Manager


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. To disable the power manager's timeouts more permanently, run the following as root:

    echo 1 >/var/lib/power_manager/ignore_external_policy
    for i in {,un}plugged_{dim,off,suspend}_ms; do
      echo 0 >/var/lib/power_manager/$i
    restart powerd

    To revert to the normal behavior, remove the files that you just created from /var/lib/power_manager and restart the powerd job again.

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

The power manager gives other daemons an opportunity to do any preparation that they need to just before the system is suspended. See src/platform/system_api/dbus/power_manager/suspend.proto for a detailed description of the process, along with the definitions of the protocol buffers that are passed over D-Bus, and src/platform2/power_manager/tools/ for an example implementation.

Additional details