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-11-25 19:55:50 +0000
commit292b9a6f6ab27a3c520090e0e0d8aba4522abca8 (patch)
treeebe7ad0459aea71fa2eaac3b58ffe1797447e439
parenta93aa4a3cc14ca11f2833f7b803f1442aa8a4d06 (diff)
downloadvboot-292b9a6f6ab27a3c520090e0e0d8aba4522abca8.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>
-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);