summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/2lib/2ui_screens.c11
-rw-r--r--tests/vb2_ui_tests.c50
2 files changed, 47 insertions, 14 deletions
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index 741f4b91..4af80950 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -215,7 +215,7 @@ static const struct vb2_screen_info recovery_broken_screen = {
/* VB2_SCREEN_ADVANCED_OPTIONS */
#define ADVANCED_OPTIONS_ITEM_DEVELOPER_MODE 1
-#define ADVANCED_OPTIONS_ITEM_BACK 2
+#define ADVANCED_OPTIONS_ITEM_DEBUG_INFO 2
vb2_error_t advanced_options_init(struct vb2_ui_context *ui)
{
@@ -224,7 +224,7 @@ vb2_error_t advanced_options_init(struct vb2_ui_context *ui)
!vb2_allow_recovery(ui->ctx)) {
ui->state->disabled_item_mask |=
1 << ADVANCED_OPTIONS_ITEM_DEVELOPER_MODE;
- ui->state->selected_item = ADVANCED_OPTIONS_ITEM_BACK;
+ ui->state->selected_item = ADVANCED_OPTIONS_ITEM_DEBUG_INFO;
}
return VB2_REQUEST_UI_CONTINUE;
@@ -236,8 +236,11 @@ static const struct vb2_menu_item advanced_options_items[] = {
.text = "Enable developer mode",
.target = VB2_SCREEN_RECOVERY_TO_DEV,
},
- /* TODO(b:144969088): Add debug info item */
- [ADVANCED_OPTIONS_ITEM_BACK] = BACK_ITEM,
+ [ADVANCED_OPTIONS_ITEM_DEBUG_INFO] = {
+ .text = "Debug info",
+ .target = VB2_SCREEN_DEBUG_INFO,
+ },
+ BACK_ITEM,
POWER_OFF_ITEM,
};
diff --git a/tests/vb2_ui_tests.c b/tests/vb2_ui_tests.c
index 86833640..d4e0ae57 100644
--- a/tests/vb2_ui_tests.c
+++ b/tests/vb2_ui_tests.c
@@ -1243,7 +1243,11 @@ static void developer_screen_tests(void)
add_mock_keypress(VB_KEY_UP);
add_mock_keypress(VB_KEY_ENTER);
/* #1: (Disabled) */
- /* #2: Back */
+ /* #2: Debug info */
+ add_mock_keypress(VB_KEY_ESC);
+ add_mock_keypress(VB_KEY_DOWN);
+ add_mock_keypress(VB_KEY_ENTER);
+ /* #3: Back */
add_mock_keypress(VB_KEY_ESC);
add_mock_keypress(VB_KEY_DOWN);
add_mock_keypress(VB_KEY_ENTER);
@@ -1262,11 +1266,17 @@ static void developer_screen_tests(void)
DISPLAYED_EQ("#0: language menu", VB2_SCREEN_LANGUAGE_SELECT,
MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
/* #1: (Disabled) */
- /* #2: Back */
+ /* #2: Debug info */
DISPLAYED_PASS();
DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
MOCK_IGNORE, 2, 0x2, MOCK_IGNORE);
- DISPLAYED_EQ("#2: back", VB2_SCREEN_DEVELOPER_MODE,
+ DISPLAYED_EQ("#2: debug info", VB2_SCREEN_DEBUG_INFO,
+ MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
+ /* #3: Back */
+ DISPLAYED_PASS();
+ DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
+ MOCK_IGNORE, 3, 0x2, MOCK_IGNORE);
+ DISPLAYED_EQ("#3: back", VB2_SCREEN_DEVELOPER_MODE,
MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
/* End of menu */
DISPLAYED_EQ("end of menu", VB2_SCREEN_ADVANCED_OPTIONS,
@@ -1316,7 +1326,11 @@ static void broken_recovery_screen_tests(void)
add_mock_keypress(VB_KEY_UP);
add_mock_keypress(VB_KEY_ENTER);
/* #1: (Disabled) */
- /* #2: Back */
+ /* #2: Debug info */
+ add_mock_keypress(VB_KEY_ESC);
+ add_mock_keypress(VB_KEY_DOWN);
+ add_mock_keypress(VB_KEY_ENTER);
+ /* #3: Back */
add_mock_keypress(VB_KEY_ESC);
add_mock_keypress(VB_KEY_DOWN);
add_mock_keypress(VB_KEY_ENTER);
@@ -1326,18 +1340,24 @@ static void broken_recovery_screen_tests(void)
TEST_EQ(vb2_broken_recovery_menu(ctx), VB2_REQUEST_SHUTDOWN,
"advanced options screen");
DISPLAYED_PASS();
- /* #0: Language menu */
DISPLAYED_PASS();
+ /* #0: Language menu */
DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
MOCK_IGNORE, 0, 0x2, MOCK_IGNORE);
DISPLAYED_EQ("#0: language menu", VB2_SCREEN_LANGUAGE_SELECT,
MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
/* #1: (Disabled) */
- /* #2: Back */
+ /* #2: Debug info */
DISPLAYED_PASS();
DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
MOCK_IGNORE, 2, 0x2, MOCK_IGNORE);
- DISPLAYED_EQ("#2: back", VB2_SCREEN_RECOVERY_BROKEN,
+ DISPLAYED_EQ("#2: debug info", VB2_SCREEN_DEBUG_INFO,
+ MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
+ /* #3: Back */
+ DISPLAYED_PASS();
+ DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
+ MOCK_IGNORE, 3, 0x2, MOCK_IGNORE);
+ DISPLAYED_EQ("#3: back", VB2_SCREEN_RECOVERY_BROKEN,
MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
/* End of menu */
DISPLAYED_EQ("end of menu", VB2_SCREEN_ADVANCED_OPTIONS,
@@ -1415,7 +1435,11 @@ static void manual_recovery_screen_tests(void)
add_mock_keypress(VB_KEY_ESC);
add_mock_keypress(VB_KEY_DOWN);
add_mock_keypress(VB_KEY_ENTER);
- /* #2: Back */
+ /* #2: Debug info */
+ add_mock_keypress(VB_KEY_ESC);
+ add_mock_keypress(VB_KEY_DOWN);
+ add_mock_keypress(VB_KEY_ENTER);
+ /* #3: Back */
add_mock_keypress(VB_KEY_ESC);
add_mock_keypress(VB_KEY_DOWN);
add_mock_keypress(VB_KEY_ENTER);
@@ -1440,11 +1464,17 @@ static void manual_recovery_screen_tests(void)
MOCK_IGNORE, 1, 0x0, MOCK_IGNORE);
DISPLAYED_EQ("#1: enable dev mode", VB2_SCREEN_RECOVERY_TO_DEV,
MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
- /* #2: Back */
+ /* #2: Debug info */
DISPLAYED_PASS();
DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
MOCK_IGNORE, 2, 0x0, MOCK_IGNORE);
- DISPLAYED_EQ("#2: back", VB2_SCREEN_RECOVERY_SELECT,
+ DISPLAYED_EQ("#2: debug info", VB2_SCREEN_DEBUG_INFO,
+ MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
+ /* #3: Back */
+ DISPLAYED_PASS();
+ DISPLAYED_EQ("advanced options", VB2_SCREEN_ADVANCED_OPTIONS,
+ MOCK_IGNORE, 3, 0x0, MOCK_IGNORE);
+ DISPLAYED_EQ("#3: back", VB2_SCREEN_RECOVERY_SELECT,
MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE, MOCK_IGNORE);
/* End of menu */
DISPLAYED_PASS();