diff options
-rw-r--r-- | firmware/lib/vboot_display.c | 19 | ||||
-rw-r--r-- | firmware/lib/vboot_ui_menu.c | 13 |
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: |