summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2020-07-16 10:22:05 +0800
committerCommit Bot <commit-bot@chromium.org>2020-07-28 17:00:17 +0000
commit640d0cb5b1e0a95b0a723c27f6b73638df5feddb (patch)
tree54ff469c40632ecbe790107723b3e465f456d458
parent588839c060d0e977594720bc9fc1ab054d1f5178 (diff)
downloadvboot-640d0cb5b1e0a95b0a723c27f6b73638df5feddb.tar.gz
vboot/ui: decouple error beep from error message
Some error such as VB2_UI_ERROR_DEV_EXTERNAL_BOOT_FAILED only requires a beep sound to notify the user. No dialog box will be shown for these errors. Instead of defining them in the vb2_ui_error enum and ignore them in vb2ex_display_ui() in depthcharge, add a new field 'error_beep' to vb2_ui_context and use it for playing error beep sound in the UI loop. Then these beep-only errors can be removed from the enum. Also remove VB2_UI_ERROR_DEV_INTERNAL_NOT_ALLOWED because it is not used everywhere. BRANCH=puff BUG=b:146399181, b:161375587 TEST=emerge-puff depthcharge TEST=b/161375587 is not reproducible Cq-Depend: chromium:2299925 Change-Id: Ia90d1c8a164334d4cfec84281722eb6f2623b111 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2299968 Reviewed-by: Joel Kitching <kitching@chromium.org>
-rw-r--r--firmware/2lib/2ui.c9
-rw-r--r--firmware/2lib/2ui_screens.c6
-rw-r--r--firmware/2lib/include/2api.h6
-rw-r--r--firmware/2lib/include/2ui.h5
4 files changed, 10 insertions, 16 deletions
diff --git a/firmware/2lib/2ui.c b/firmware/2lib/2ui.c
index 23b7b0dd..fea3b4ad 100644
--- a/firmware/2lib/2ui.c
+++ b/firmware/2lib/2ui.c
@@ -327,13 +327,10 @@ vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id,
ui.state->disabled_item_mask,
ui.disable_timer,
ui.error_code);
- /*
- * Only beep if we're transitioning from no
- * error to an error.
- */
- if (prev_error_code == VB2_UI_ERROR_NONE &&
- ui.error_code != VB2_UI_ERROR_NONE)
+ if (ui.error_beep) {
vb2ex_beep(250, 400);
+ ui.error_beep = 0;
+ }
/* Update prev variables. */
memcpy(&prev_state, ui.state, sizeof(*ui.state));
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index 97c9b5e5..ab15a2b3 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -490,7 +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;
+ ui->error_beep = 1;
return VB2_REQUEST_UI_CONTINUE;
}
@@ -501,7 +501,7 @@ vb2_error_t vb2_ui_developer_mode_boot_external_action(
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;
+ ui->error_beep = 1;
}
return vb2_ui_screen_change(
ui, VB2_SCREEN_DEVELOPER_BOOT_EXTERNAL);
@@ -509,7 +509,7 @@ vb2_error_t vb2_ui_developer_mode_boot_external_action(
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;
+ ui->error_beep = 1;
}
return vb2_ui_screen_change(
ui, VB2_SCREEN_DEVELOPER_INVALID_DISK);
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index e001230a..b6c9bea4 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1297,12 +1297,6 @@ enum vb2_ui_error {
VB2_UI_ERROR_NONE = 0,
/* Dev mode already enabled */
VB2_UI_ERROR_DEV_MODE_ALREADY_ENABLED,
- /* Dev mode internal boot not allowed */
- VB2_UI_ERROR_DEV_INTERNAL_NOT_ALLOWED,
- /* Dev mode external boot not allowed */
- VB2_UI_ERROR_DEV_EXTERNAL_NOT_ALLOWED,
- /* Dev mode external boot failed */
- VB2_UI_ERROR_DEV_EXTERNAL_BOOT_FAILED,
};
/**
diff --git a/firmware/2lib/include/2ui.h b/firmware/2lib/include/2ui.h
index 35dddb89..fa8c66a3 100644
--- a/firmware/2lib/include/2ui.h
+++ b/firmware/2lib/include/2ui.h
@@ -89,8 +89,11 @@ struct vb2_ui_context {
/* For language selection screen. */
struct vb2_menu language_menu;
+ /* For error beep sound. */
+ int error_beep;
+
/* For displaying error messages. */
- enum vb2_ui_error error_code;
+ enum vb2_ui_error error_code;
};
vb2_error_t vb2_ui_developer_mode_boot_internal_action(