summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-04-01 15:04:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-04 15:10:16 -0700
commit70ba5afd959e0c3d40c6d6d651302be18f19ebd9 (patch)
treea698498f8733572eec9e772c0f6eb8d23e2e57a6
parentcec5844155be07ef37316d3e085fb996803214fd (diff)
downloadvboot-70ba5afd959e0c3d40c6d6d651302be18f19ebd9.tar.gz
ui: Allow dismissing debug output with Esc, fix detachable issues
The new debug output using the HWID font looks pretty, but it does bring a few new UX issues since it often completely overlays the main firmware screen. This patch adds the ability to force redrawing the screen (i.e. dismissing any debug text that might be on there) by pressing Esc (which is probably the most natural thing a user would press to try to get rid of the text). This check for Esc happens after any other key checks, so pressing it at the TO_DEV screen will still return you to the recovery screen (as it has before). I also noticed some problems when dismissing debug info by selecting a different menu option in the detachable UI: we don't normally redraw the whole screen when switching between options, so this will still leave the debug output in the background (which is usable but ugly). With this patch the detachable UI will always redraw the screen on the first draw request after displaying debug info. BRANCH=None BUG=None TEST=Manually went through affected transitions on Kevin (both clamshell and detachable). Change-Id: Ifadbc1a258bb7a7f8029e0f1f1786230aa724ae5 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1548301 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
-rw-r--r--firmware/lib/vboot_display.c19
-rw-r--r--firmware/lib/vboot_ui_menu.c13
2 files changed, 22 insertions, 10 deletions
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index 6ed5ad6c..f9c520da 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -72,7 +72,7 @@ VbError_t VbDisplayMenu(struct vb2_context *ctx, uint32_t screen, int force,
* If current screen is not the same, make sure we redraw the base
* screen as well to avoid having artifacts from the menu.
*/
- if (disp_current_screen != screen)
+ if (disp_current_screen != screen || force)
redraw_base_screen = 1;
/*
@@ -415,6 +415,8 @@ static uint8_t MagicBuffer[MAGIC_WORD_LEN];
VbError_t VbCheckDisplayKey(struct vb2_context *ctx, uint32_t key,
const VbScreenData *data)
{
+ uint32_t loc = 0;
+ uint32_t count = 0;
int i;
/* Update key buffer */
@@ -423,15 +425,18 @@ VbError_t VbCheckDisplayKey(struct vb2_context *ctx, uint32_t key,
/* Save as lower-case ASCII */
MagicBuffer[MAGIC_WORD_LEN - 1] = (key | 0x20) & 0xFF;
- if ('\t' == key) {
+ switch (key) {
+ case '\t':
/* Tab = display debug info */
return VbDisplayDebugInfo(ctx);
- } else if (VB_KEY_LEFT == key || VB_KEY_RIGHT == key ||
- VB_KEY_DOWN == key || VB_KEY_UP == key) {
+ case VB_KEY_ESC:
+ /* Force redraw current screen (to clear Tab debug output) */
+ return VbDisplayScreen(ctx, disp_current_screen, 1, data);
+ case VB_KEY_LEFT:
+ case VB_KEY_RIGHT:
+ case VB_KEY_UP:
+ case VB_KEY_DOWN:
/* Arrow keys = change localization */
- uint32_t loc = 0;
- uint32_t count = 0;
-
loc = vb2_nv_get(ctx, VB2_NV_LOCALIZATION_INDEX);
if (VBERROR_SUCCESS != VbExGetLocalizationCount(&count))
loc = 0; /* No localization count (bad GBB?) */
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 8ee27701..6c65f1c5 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -31,7 +31,7 @@ static const char dev_disable_msg[] =
"\n";
static VB_MENU current_menu, prev_menu;
-static int current_menu_idx, disabled_idx_mask, usb_nogood;
+static int current_menu_idx, disabled_idx_mask, usb_nogood, force_redraw;
static uint32_t default_boot;
static uint32_t disable_dev_boot;
static uint32_t altfw_allowed;
@@ -64,8 +64,10 @@ static int VbWantShutdownMenu(struct vb2_context *ctx)
/* (Re-)Draw the menu identified by current_menu[_idx] to the screen. */
static VbError_t vb2_draw_current_screen(struct vb2_context *ctx) {
- return VbDisplayMenu(ctx, menus[current_menu].screen, 0,
- current_menu_idx, disabled_idx_mask);
+ VbError_t ret = VbDisplayMenu(ctx, menus[current_menu].screen,
+ force_redraw, current_menu_idx, disabled_idx_mask);
+ force_redraw = 0;
+ return ret;
}
/* Flash the screen to black to catch user awareness, then redraw menu. */
@@ -301,6 +303,7 @@ static VbError_t enter_altfw_menu(struct vb2_context *ctx)
static VbError_t debug_info_action(struct vb2_context *ctx)
{
+ force_redraw = 1;
VbDisplayDebugInfo(ctx);
return VBERROR_KEEP_LOOPING;
}
@@ -451,6 +454,10 @@ static VbError_t vb2_handle_menu_input(struct vb2_context *ctx,
case '\t':
/* Tab = display debug info */
return debug_info_action(ctx);
+ case VB_KEY_ESC:
+ /* Esc = redraw screen (to clear old debug info) */
+ vb2_draw_current_screen(ctx);
+ break;
case VB_KEY_UP:
case VB_KEY_DOWN:
case VB_BUTTON_VOL_UP_SHORT_PRESS: