Chromium OS‎ > ‎packages‎ > ‎

Power Manager

Overview

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 already available. Once installed, it will keep the system from auto-sleeping as long as it is enabled.

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/suspend_delay_sample.cc for an example implementation.

Additional details

  • Suspend and Resume describes the suspend process from powerd's perspective.
  • Screen Brightness describes how the internal panel's brightness is controlled.
  • Inactivity Delays describes actions that are performed when the system is inactive.
  • Input describes how powerd observes user input.