From ff099529216cc4a72409a52cfaacfbcec7797f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Thu, 10 Mar 2016 06:33:00 +0100 Subject: coreinfo: Default to first non-empty category MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... instead of the overall first one. Change-Id: If9b2674ff2ef83b7c24a3388316b6f4128bc1007 Signed-off-by: Jonathan Neuschäfer Reviewed-on: https://review.coreboot.org/14027 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Martin Roth --- payloads/coreinfo/coreinfo.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'payloads/coreinfo') 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]); -- cgit v1.2.3