mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 17:52:20 +00:00
fix(menu): fall back to the basic menu if the simple menu fails
The simple menu failed, and boot was aborted, when the console couldn't set the cursor position or colors or clear the screen, which some serial consoles and minimal console drivers don't support. Use the basic menu, which only prints text, when the simple menu fails.
This commit is contained in:
1 parent
5fd2dbb4a7
commit
b39436cbe2
1 file changed
+12
-5
+12
-5
@@ -126,10 +126,17 @@ pub fn select<'live>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pick the menu that implements the requested style.
|
// Pick the menu that implements the requested style.
|
||||||
let menu: &dyn BootMenu = match style {
|
match style {
|
||||||
MenuStyle::Basic => &BasicMenu,
|
MenuStyle::Basic => BasicMenu.select(timeout, entries),
|
||||||
MenuStyle::Simple => &SimpleMenu,
|
|
||||||
};
|
|
||||||
|
|
||||||
menu.select(timeout, entries)
|
// The simple menu needs a console that can move the cursor and set colors, which
|
||||||
|
// not every console supports. If it fails, the basic menu is used instead.
|
||||||
|
MenuStyle::Simple => SimpleMenu.select(timeout, entries).or_else(|error| {
|
||||||
|
warn!(
|
||||||
|
"unable to show the simple boot menu, using the basic menu: {:#}",
|
||||||
|
error
|
||||||
|
);
|
||||||
|
BasicMenu.select(timeout, entries)
|
||||||
|
}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user