Modify EC reboot function to match software sync behavior
On devices with EC software sync, after an EC reboot, system powers on
if and only if lid is open. Let's check lid switch to decide if a power
button press is necessary.
BUG=chrome-os-partner:11970
TEST=firmware_ECWatchdog passed.
Change-Id: I93cb06db63231f97d2b21531a21addc2a0fffbe3
Reviewed-on: https://gerrit.chromium.org/gerrit/28676
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 1989608..8eae69c 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -101,6 +101,8 @@
POWER_BTN_DELAY = 0.5
# Delay between sending keystroke to firmware
FIRMWARE_KEY_DELAY = 0.5
+ # Delay of EC software sync hash calculating time
+ SOFTWARE_SYNC_DELAY = 6
# The developer screen timeouts fit our spec.
DEV_SCREEN_TIMEOUT = 30
@@ -908,8 +910,20 @@
time.sleep(self.SYNC_DELAY)
self.faft_client.run_shell_command('(sleep %d; ectool reboot_ec)&' %
self.EC_REBOOT_DELAY)
- time.sleep(self.EC_REBOOT_DELAY + self.POWER_BTN_DELAY)
- self.servo.power_normal_press()
+ time.sleep(self.EC_REBOOT_DELAY)
+ self.check_lid_and_power_on()
+
+
+ def check_lid_and_power_on(self):
+ """
+ On devices with EC software sync, system powers on after EC reboots if
+ lid is open. Otherwise, the EC shuts down CPU after about 3 seconds.
+ This method checks lid switch state and presses power button if
+ necessary.
+ """
+ if self.servo.get("lid_open") == "no":
+ time.sleep(self.SOFTWARE_SYNC_DELAY)
+ self.servo.power_short_press()
def _modify_usb_kernel(self, usb_dev, from_magic, to_magic):