summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2020-09-08 10:40:37 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-24 04:19:37 +0000
commit98ab5ea45d8eaa194e52f0347fc19f767663f8c1 (patch)
tree9dd29340bb63e7a2221b4b667b691d668a81eb36
parenta2291a962395440966a9aac2c241d46e07f23e2d (diff)
downloadvboot-98ab5ea45d8eaa194e52f0347fc19f767663f8c1.tar.gz
vboot/ui: Always beep when error dialog is shown
Setting error_code always implies we need to beep. BUG=b:146399181 TEST=Build locally BRANCH=zork Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I65d790a63739f36dc1db8e22321adbff26d70893 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2397017 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r--firmware/2lib/2ui.c6
-rw-r--r--firmware/2lib/2ui_screens.c9
2 files changed, 4 insertions, 11 deletions
diff --git a/firmware/2lib/2ui.c b/firmware/2lib/2ui.c
index 4ddbcef0..07254c69 100644
--- a/firmware/2lib/2ui.c
+++ b/firmware/2lib/2ui.c
@@ -80,7 +80,7 @@ vb2_error_t error_exit_action(struct vb2_ui_context *ui)
* key press clears that error. Unset the key so that it is
* not processed by other action functions.
*/
- if (ui->key && ui->error_code != VB2_UI_ERROR_NONE) {
+ if (ui->key && ui->error_code) {
ui->error_code = VB2_UI_ERROR_NONE;
ui->key = 0;
}
@@ -335,7 +335,9 @@ vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id,
ui.disable_timer,
ui.state->current_page,
ui.error_code);
- if (ui.error_beep) {
+ if (ui.error_beep ||
+ (ui.error_code &&
+ prev_error_code != ui.error_code)) {
vb2ex_beep(250, 400);
ui.error_beep = 0;
}
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index ec5aa08a..d0e44ee1 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -818,7 +818,6 @@ static vb2_error_t developer_to_norm_init(struct vb2_ui_context *ui)
/* Don't allow to-norm if GBB forces dev mode */
if (vb2_get_gbb(ui->ctx)->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) {
VB2_DEBUG("ERROR: to-norm not allowed\n");
- ui->error_beep = 1;
ui->error_code = VB2_UI_ERROR_TO_NORM_NOT_ALLOWED;
return vb2_ui_screen_back(ui);
}
@@ -905,7 +904,6 @@ static const struct vb2_menu_item developer_select_bootloader_items_after[] = {
static vb2_error_t developer_select_bootloader_init(struct vb2_ui_context *ui)
{
if (get_menu(ui)->num_items == 0) {
- ui->error_beep = 1;
ui->error_code = VB2_UI_ERROR_NO_BOOTLOADER;
return vb2_ui_screen_back(ui);
}
@@ -926,14 +924,12 @@ vb2_error_t vb2_ui_developer_mode_boot_alternate_action(
!vb2_dev_boot_allowed(ui->ctx) ||
!vb2_dev_boot_legacy_allowed(ui->ctx)) {
VB2_DEBUG("ERROR: Dev mode alternate bootloader not allowed\n");
- ui->error_beep = 1;
ui->error_code = VB2_UI_ERROR_ALTERNATE_BOOT_DISABLED;
return VB2_REQUEST_UI_CONTINUE;
}
if (vb2ex_get_bootloader_count() == 0) {
VB2_DEBUG("ERROR: No alternate bootloader was found\n");
- ui->error_beep = 1;
ui->error_code = VB2_UI_ERROR_NO_BOOTLOADER;
return VB2_REQUEST_UI_CONTINUE;
}
@@ -950,7 +946,6 @@ vb2_error_t vb2_ui_developer_mode_boot_alternate_action(
VbExLegacy(altfw_num);
VB2_DEBUG("ERROR: Alternate bootloader failed\n");
- ui->error_beep = 1;
ui->error_code = VB2_UI_ERROR_ALTERNATE_BOOT_FAILED;
return VB2_REQUEST_UI_CONTINUE;
}
@@ -1049,7 +1044,6 @@ static vb2_error_t diagnostics_storage_init(struct vb2_ui_context *ui)
if (!log_string) {
VB2_DEBUG("ERROR: Failed to retrieve storage log message\n");
ui->error_code = VB2_UI_ERROR_DIAGNOSTICS;
- ui->error_beep = 1;
return vb2_ui_screen_back(ui);
}
@@ -1057,7 +1051,6 @@ static vb2_error_t diagnostics_storage_init(struct vb2_ui_context *ui)
if (ui->state->page_count == 0) {
VB2_DEBUG("ERROR: Failed to prepare storage log screen\n");
ui->error_code = VB2_UI_ERROR_DIAGNOSTICS;
- ui->error_beep = 1;
return vb2_ui_screen_back(ui);
}
return log_page_init(ui, DIAGNOSTICS_STORAGE_ITEM_PAGE_DOWN,
@@ -1102,7 +1095,6 @@ static vb2_error_t diagnostics_memory_update_screen(struct vb2_ui_context *ui,
if ((rv && rv != VB2_ERROR_EX_DIAG_TEST_RUNNING) || !log_string) {
VB2_DEBUG("ERROR: Failed to retrieve memory test status\n");
ui->error_code = VB2_UI_ERROR_DIAGNOSTICS;
- ui->error_beep = 1;
return vb2_ui_screen_back(ui);
}
@@ -1111,7 +1103,6 @@ static vb2_error_t diagnostics_memory_update_screen(struct vb2_ui_context *ui,
VB2_DEBUG("ERROR: Failed to prepare memory log screen, error: "
"%#x\n", rv);
ui->error_code = VB2_UI_ERROR_DIAGNOSTICS;
- ui->error_beep = 1;
return vb2_ui_screen_back(ui);
}
if (ui->state->current_page >= ui->state->page_count)