Commit 2faeee15 authored by chirantan's avatar chirantan Committed by Commit bot

Enable dark_resume_always workaround if the wake-on-packets flag is set

The dark_resume_always workaround is necessary for testing
wake-on-packets functionality because the mechanism to actually query
the wakeup source is not ready yet.  This workaround tells the kernel to
always enter dark resume and rely on chrome and powerd to detect user
activity and transition into fully resumed.

BUG=414949
Signed-off-by: default avatarChirantan Ekbote <chirantan@chromium.org>

Review URL: https://codereview.chromium.org/589723003

Cr-Commit-Position: refs/heads/master@{#296082}
parent efc44699
...@@ -22,12 +22,29 @@ const char kLightBarControlPath[] = ...@@ -22,12 +22,29 @@ const char kLightBarControlPath[] =
"lightbar/sequence"; "lightbar/sequence";
const char kKonamiCommand[] = "KONAMI"; const char kKonamiCommand[] = "KONAMI";
// TODO(chirantan): These are used by a temporary workaround for lucid sleep and
// should be removed once the proper implementation is ready (crbug.com/414949).
const char kDarkResumeAlwaysFile[] = "/sys/power/dark_resume_always";
const char kEnableDarkResumeAlways[] = "1";
} // namespace } // namespace
LightBar::LightBar() LightBar::LightBar()
: control_path_(base::FilePath(kLightBarControlPath)), : control_path_(base::FilePath(kLightBarControlPath)),
has_light_bar_(base::PathIsWritable(control_path_)) { has_light_bar_(base::PathIsWritable(control_path_)) {
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
// Until the kernel can properly detect the wakeup source, we need to use a
// hack to tell the kernel to always enter dark resume. Chrome can then
// detect any user activity and have the power manager transition out of dark
// resume into regular resume. We don't care if the write succeeds or not
// because most devices will not have this file.
//
// TODO(chirantan): Remove this once we can properly detect the wakeup
// source (crbug.com/414949).
base::WriteFile(base::FilePath(kDarkResumeAlwaysFile),
kEnableDarkResumeAlways,
strlen(kEnableDarkResumeAlways));
} }
LightBar::~LightBar() { LightBar::~LightBar() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment