summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Delco <delco@google.com>2019-03-21 12:18:49 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-05-17 18:05:59 +0000
commitf64f7d170a516b96e90e47bd741a7258f203a744 (patch)
tree90fcfbd8f6f8707cbe5ba484ec8b676c84c1638f
parentcfe661076d042eebe54a888e799c37976311770a (diff)
downloadvboot-f64f7d170a516b96e90e47bd741a7258f203a744.tar.gz
vboot: remove workaround in diagnostics UI
The cr50 has been changed to report live status of the power button so this workaround is no longer needed. BUG=b:128431787 BRANCH=None TEST=Locally built and flashed onto system with modified cr50. Verified that power button status is read and works reliably. Change-Id: Ia9b33610c897085e79dd18805350c41e17e3d9f2 Signed-off-by: Matt Delco <delco@google.com> Reviewed-on: https://chromium-review.googlesource.com/1534621 Commit-Ready: Matt Delco <delco@chromium.org> Tested-by: Matt Delco <delco@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> (cherry picked from commit 6eeddec87185eac611ceb3fb8003f04c503fd54e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1615057 Tested-by: John Su <john_su@compal.corp-partner.google.com> Reviewed-by: Matt Delco <delco@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
-rw-r--r--firmware/lib/vboot_ui.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index af8450da..60afadc9 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -413,6 +413,7 @@ static VbError_t vb2_check_diagnostic_key(struct vb2_context *ctx,
static VbError_t vb2_diagnostics_ui(struct vb2_context *ctx)
{
int active = 1;
+ int power_button_was_released = 0;
int power_button_was_pressed = 0;
VbError_t result = VBERROR_REBOOT_REQUIRED;
int action_confirmed = 0;
@@ -432,33 +433,22 @@ static VbError_t vb2_diagnostics_ui(struct vb2_context *ctx)
* on detachables, and this function wants to see for itself
* that the power button isn't currently pressed.
*/
- uint32_t power_pressed =
- VbExGetSwitches(VB_SWITCH_FLAG_PHYS_PRESENCE_PRESSED);
- /*
- * TODO(delco): Remove this workaround. On Wilco a button
- * press is only reported a single time regardless of the
- * duration of the press. Until it's changed to report the
- * live/current status of the button we can't ignore when
- * VbWantShutdown() reports a button press (well, we can
- * ignore it but the user might have to press the power button
- * more than once for this code to react).
- */
- int shutdown = VbWantShutdown(ctx, 0);
- if (shutdown & VB_SHUTDOWN_REQUEST_POWER_BUTTON) {
- power_pressed = 1;
- }
-
- if (power_pressed) {
- power_button_was_pressed = 1;
- } else if (power_button_was_pressed) {
- VB2_DEBUG("vb2_diagnostics_ui() - power released\n");
- action_confirmed = 1;
- active = 0;
- break;
+ if (VbExGetSwitches(VB_SWITCH_FLAG_PHYS_PRESENCE_PRESSED)) {
+ /* Wait for a release before registering a press. */
+ if (power_button_was_released)
+ power_button_was_pressed = 1;
+ } else {
+ power_button_was_released = 1;
+ if (power_button_was_pressed) {
+ VB2_DEBUG("vb2_diagnostics_ui() - power released\n");
+ action_confirmed = 1;
+ active = 0;
+ break;
+ }
}
/* Check the lid and ignore the power button. */
- if (shutdown & VB_SHUTDOWN_REQUEST_LID_CLOSED) {
+ if (VbWantShutdown(ctx, 0) & ~VB_SHUTDOWN_REQUEST_POWER_BUTTON) {
VB2_DEBUG("vb2_diagnostics_ui() - shutdown request\n");
result = VBERROR_SHUTDOWN_REQUESTED;
active = 0;