mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-05 01:52:21 +00:00
fix(menu): ignore key events without an available key
Some firmware signals the key event without a key being available. This previously aborted boot with "no key was pressed"; treat it as a no-op and keep waiting instead.
This commit is contained in:
1 parent
1f5bc07c22
commit
f7e7a9122b
1 file changed
+4
-2
@@ -1,6 +1,6 @@
|
|||||||
use crate::entries::BootableEntry;
|
use crate::entries::BootableEntry;
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use anyhow::{Context, Result, bail};
|
use anyhow::{Context, Result};
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use eficore::bootloader_interface::BootloaderInterface;
|
use eficore::bootloader_interface::BootloaderInterface;
|
||||||
use eficore::platform::timer::PlatformTimer;
|
use eficore::platform::timer::PlatformTimer;
|
||||||
@@ -86,8 +86,10 @@ fn read(input: &mut Input, timeout: &Duration) -> Result<MenuOperation> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we reach here, there is a key event.
|
// If we reach here, there is a key event.
|
||||||
|
// Some firmware signals the key event without a key being available,
|
||||||
|
// in which case there is nothing to do.
|
||||||
let Some(key) = input.read_key().context("unable to read key")? else {
|
let Some(key) = input.read_key().context("unable to read key")? else {
|
||||||
bail!("no key was pressed");
|
return Ok(MenuOperation::Nop);
|
||||||
};
|
};
|
||||||
|
|
||||||
match key {
|
match key {
|
||||||
|
|||||||
Reference in new issue
Block a user