summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew King <mathewk@chromium.org>2019-11-21 14:51:28 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-03 04:10:07 +0000
commit0ca8cda82a5870e971c91340138cce9415464513 (patch)
tree0c5d00de0244dec22344f0dd227e1d75728d1b2b
parentb50f6f11c436eead6cb07ad821a133881406f804 (diff)
downloadvboot-0ca8cda82a5870e971c91340138cce9415464513.tar.gz
vboot: Don't warn user if enter key is pressed if rec switch is physical
When the recovery switch is physical then the propmt to enter dev mode will say to press the recovery switch not the enter key. In this case we do not want to warn the user that an internal keyboard is needed to confirm we will just silently ignore the enter key. BUG=b:144034020 TEST=On Drallion enter key does not work to switch to dev mode and does not beep or print a warning when the enter key is pressed BRANCH=none Change-Id: I250ea2622c9c38bfc0d7463eb95ca65a12b41153 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1929601 Tested-by: Mathew King <mathewk@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Mathew King <mathewk@chromium.org> (cherry picked from commit 292b9a6f6ab27a3c520090e0e0d8aba4522abca8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1947348 Reviewed-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
-rw-r--r--firmware/lib/vboot_ui.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 642f149e..f7e82a99 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -112,21 +112,31 @@ int VbUserConfirms(struct vb2_context *ctx, uint32_t confirm_flags)
shutdown_requested = VbWantShutdown(ctx, key);
switch (key) {
case VB_KEY_ENTER:
- /* If we require a trusted keyboard for confirmation,
- * but the keyboard may be faked (for instance, a USB
- * device), beep and keep waiting.
+ /* If we are using a trusted keyboard or a trusted
+ * keyboard is not required then return yes, otherwise
+ * keep waiting (for instance if the user is using a
+ * USB keyboard).
*/
- if (confirm_flags & VB_CONFIRM_MUST_TRUST_KEYBOARD &&
- !(key_flags & VB_KEY_FLAG_TRUSTED_KEYBOARD)) {
+ if (!(confirm_flags & VB_CONFIRM_MUST_TRUST_KEYBOARD) ||
+ (key_flags & VB_KEY_FLAG_TRUSTED_KEYBOARD)) {
+ VB2_DEBUG("Yes (1)\n");
+ return 1;
+ }
+
+ /* Beep and notify the user if the recovery switch is
+ * not physical. If it is physical then the prompt will
+ * tell the user to press the switch and will not say
+ * anything about the ENTER key so we can silenty ingore
+ * ENTER in this case.
+ */
+ if (shared->flags & VBSD_BOOT_REC_SWITCH_VIRTUAL)
vb2_error_notify("Please use internal keyboard "
"to confirm\n",
"VbUserConfirms() - "
- "Trusted keyboard is requierd\n",
+ "Trusted keyboard is required\n",
VB_BEEP_NOT_ALLOWED);
- break;
- }
- VB2_DEBUG("Yes (1)\n");
- return 1;
+
+ break;
case ' ':
VB2_DEBUG("Space (%d)\n",
confirm_flags & VB_CONFIRM_SPACE_MEANS_NO);