summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-10-01 17:42:17 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-10-02 13:23:08 -0700
commit00d4be66721b24903f977e770148179035254e19 (patch)
tree2d277c76bae7c3c255a893cda90efebf73db3688 /firmware
parent16ceb9625ed13b0da4ae6306f9187b672b9b382f (diff)
downloadvboot-00d4be66721b24903f977e770148179035254e19.tar.gz
Ignore power button if held on startupstabilize-11151.59.Bstabilize-11151.100.B
Ignore a power button push until after we have seen it released, to avoid shutting down immediately if the power button is held down on startup. BUG=b:116819414,chromium:670492 BRANCH=grunt TEST=manual: 1) Press and hold esc+refresh+power. 2) Depthcharge shows INSERT screen and does not power off. 3) Release esc+refresh+power. 4) Press and release power. 5) Depthcharge powers off. TEST=test_that --fast -b grunt $grunt_ip firmware_ECLidShutdown TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I7421a4b1a1b8a7894f0e7d1c7927ffc52d9faac0 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1256023 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/lib/vboot_ui.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 217090ad..289e0009 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -25,6 +25,14 @@
#include "vboot_display.h"
#include "vboot_kernel.h"
+/* Global variables */
+static int power_button_released;
+
+static void vb2_init_ui(void)
+{
+ power_button_released = 0;
+}
+
static void VbAllowUsbBoot(struct vb2_context *ctx)
{
VB2_DEBUG(".");
@@ -42,6 +50,18 @@ static int VbWantShutdown(struct vb2_context *ctx, uint32_t key)
struct vb2_shared_data *sd = vb2_get_sd(ctx);
uint32_t shutdown_request = VbExIsShutdownRequested();
+ /*
+ * Ignore power button push until after we have seen it released.
+ * This avoids shutting down immediately if the power button is still
+ * being held on startup.
+ */
+ if (shutdown_request & VB_SHUTDOWN_REQUEST_POWER_BUTTON) {
+ if (!power_button_released)
+ shutdown_request &= ~VB_SHUTDOWN_REQUEST_POWER_BUTTON;
+ } else {
+ power_button_released = 1;
+ }
+
if (key == VB_BUTTON_POWER_SHORT_PRESS)
shutdown_request |= VB_SHUTDOWN_REQUEST_POWER_BUTTON;
@@ -402,6 +422,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx)
VbError_t VbBootDeveloper(struct vb2_context *ctx)
{
+ vb2_init_ui();
VbError_t retval = vb2_developer_ui(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
return retval;
@@ -552,6 +573,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx)
VbError_t VbBootRecovery(struct vb2_context *ctx)
{
+ vb2_init_ui();
VbError_t retval = recovery_ui(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0);
return retval;