summaryrefslogtreecommitdiff
path: root/firmware/2lib/2ui_screens.c
diff options
context:
space:
mode:
authorShelley Chen <shchen@google.com>2020-06-11 22:41:14 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-27 22:53:26 +0000
commit65d69f12712d262724edf1337c8055adc9edaa9d (patch)
treef4c9057b6b5cc21cd63d9790b56660a8791572a9 /firmware/2lib/2ui_screens.c
parent0776fb3aab035d32fd1148627953e2aedd08c987 (diff)
downloadvboot-65d69f12712d262724edf1337c8055adc9edaa9d.tar.gz
firmware/2lib: Add visual/audio error handling
Adding an enum parameter to vb2ex_display_ui to facilitate printing errors to the screen. Currently, errors are only printed to the serial console. Also adding in beep if an error is displayed. BUG=b:144969091,b:158635317,b:158639298,b:146399181 BRANCH=None TEST=Boot into dev warning screen and try to hit ctrl-u when no USB is plugged in. Ensure error beep occurs. Ensure in dev mode. Boot into recovery and press ctrl-d. Ensure that error message is printed to the screen and beep occurs. make runtests Cq-Depend: chromium:2243513 Change-Id: I548d624532ad8816497c37a726275b33171e28dc Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2243196 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
Diffstat (limited to 'firmware/2lib/2ui_screens.c')
-rw-r--r--firmware/2lib/2ui_screens.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index 042d6d4c..c43abb8f 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -249,7 +249,8 @@ static const struct vb2_screen_info recovery_invalid_screen = {
vb2_error_t recovery_to_dev_init(struct vb2_ui_context *ui)
{
if (vb2_get_sd(ui->ctx)->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) {
- VB2_DEBUG("Dev mode already enabled?\n");
+ /* We're in dev mode, so let user know they can't transition */
+ ui->error_code = VB2_UI_ERROR_DEV_MODE_ALREADY_ENABLED;
return vb2_ui_change_root(ui);
}
@@ -489,6 +490,7 @@ vb2_error_t vb2_ui_developer_mode_boot_external_action(
!vb2_dev_boot_allowed(ui->ctx) ||
!vb2_dev_boot_external_allowed(ui->ctx)) {
VB2_DEBUG("ERROR: Dev mode external boot not allowed\n");
+ ui->error_code = VB2_UI_ERROR_DEV_EXTERNAL_NOT_ALLOWED;
return VB2_REQUEST_UI_CONTINUE;
}
@@ -496,13 +498,17 @@ vb2_error_t vb2_ui_developer_mode_boot_external_action(
if (rv == VB2_SUCCESS) {
return VB2_SUCCESS;
} else if (rv == VB2_ERROR_LK_NO_DISK_FOUND) {
- if (ui->state.screen->id != VB2_SCREEN_DEVELOPER_BOOT_EXTERNAL)
+ if (ui->state.screen->id != VB2_SCREEN_DEVELOPER_BOOT_EXTERNAL) {
VB2_DEBUG("No external disk found\n");
+ ui->error_code = VB2_UI_ERROR_DEV_EXTERNAL_BOOT_FAILED;
+ }
return vb2_ui_change_screen(
ui, VB2_SCREEN_DEVELOPER_BOOT_EXTERNAL);
} else {
- if (ui->state.screen->id != VB2_SCREEN_DEVELOPER_INVALID_DISK)
+ if (ui->state.screen->id != VB2_SCREEN_DEVELOPER_INVALID_DISK) {
VB2_DEBUG("Invalid external disk: %#x\n", rv);
+ ui->error_code = VB2_UI_ERROR_DEV_EXTERNAL_BOOT_FAILED;
+ }
return vb2_ui_change_screen(
ui, VB2_SCREEN_DEVELOPER_INVALID_DISK);
}