summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2016-03-10 06:33:00 +0100
committerMartin Roth <martinroth@google.com>2016-03-11 18:43:22 +0100
commitff099529216cc4a72409a52cfaacfbcec7797f9b (patch)
treeb218147abf6a80c492688ffdd7517b1136ee6dc7
parent5368504e449e1adc78a869edbf77525e98df5779 (diff)
downloadcoreboot-ff099529216cc4a72409a52cfaacfbcec7797f9b.tar.xz
coreinfo: Default to first non-empty category
... instead of the overall first one. Change-Id: If9b2674ff2ef83b7c24a3388316b6f4128bc1007 Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/14027 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--payloads/coreinfo/coreinfo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c
index 82a57dab19..effe94fe3a 100644
--- a/payloads/coreinfo/coreinfo.c
+++ b/payloads/coreinfo/coreinfo.c
@@ -225,6 +225,16 @@ static void print_no_modules_selected(void)
center(height / 2, "No modules selected");
}
+static int first_nonempty_category(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(categories); i++)
+ if (categories[i].count > 0)
+ return i;
+ return 0;
+}
+
static void loop(void)
{
int key;
@@ -233,6 +243,7 @@ static void loop(void)
print_no_modules_selected();
refresh();
+ curwin = first_nonempty_category();
print_menu();
print_submenu(&categories[curwin]);
redraw_module(&categories[curwin]);