summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Delco <delco@google.com>2019-03-21 12:18:49 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-14 23:57:31 -0700
commit6eeddec87185eac611ceb3fb8003f04c503fd54e (patch)
tree4a9a5fe81a3c9b1e2a466d368d41fbc487dbc7e1
parent552c1759b5d64e2843755e51ca5ea3961f2cfb7a (diff)
downloadvboot-stabilize-12206.B.tar.gz
vboot: remove workaround in diagnostics UIstabilize-12206.B
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>
-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 5934d0c1..6009d90d 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -403,6 +403,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;
@@ -422,33 +423,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;