diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-09-11 22:38:06 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-09-23 21:55:30 +0200 |
commit | 1d69c8d8500156cd0437fd58483b9d9ca9eac34b (patch) | |
tree | 3e878aa88c5f0058e4ba829d5d99c6dd8cb17574 /lib/efi_selftest | |
parent | 0dfd13a4c850000450ed9ab135d83e4753be0770 (diff) | |
download | u-boot-1d69c8d8500156cd0437fd58483b9d9ca9eac34b.tar.gz u-boot-1d69c8d8500156cd0437fd58483b9d9ca9eac34b.tar.xz u-boot-1d69c8d8500156cd0437fd58483b9d9ca9eac34b.zip |
efi_selftest: use WaitForKey to test text input
We should test the WaitForKey event.
Testing for EFI_NOT_READY can be done after resetting the console.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_selftest')
-rw-r--r-- | lib/efi_selftest/efi_selftest_textinput.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/efi_selftest/efi_selftest_textinput.c b/lib/efi_selftest/efi_selftest_textinput.c index 40b0a8b25c..164fbffe6c 100644 --- a/lib/efi_selftest/efi_selftest_textinput.c +++ b/lib/efi_selftest/efi_selftest_textinput.c @@ -40,15 +40,36 @@ static int execute(void) { struct efi_input_key input_key = {0}; efi_status_t ret; + efi_uintn_t index; + + /* Drain the console input */ + ret = con_in->reset(con_in, true); + if (ret != EFI_SUCCESS) { + efi_st_error("Reset failed\n"); + return EFI_ST_FAILURE; + } + ret = con_in->read_key_stroke(con_in, &input_key); + if (ret != EFI_NOT_READY) { + efi_st_error("Empty buffer not reported\n"); + return EFI_ST_FAILURE; + } efi_st_printf("Waiting for your input\n"); efi_st_printf("To terminate type 'x'\n"); for (;;) { /* Wait for next key */ - do { - ret = con_in->read_key_stroke(con_in, &input_key); - } while (ret == EFI_NOT_READY); + ret = boottime->wait_for_event(1, &con_in->wait_for_key, + &index); + if (ret != EFI_ST_SUCCESS) { + efi_st_error("WaitForEvent failed\n"); + return EFI_ST_FAILURE; + } + ret = con_in->read_key_stroke(con_in, &input_key); + if (ret != EFI_SUCCESS) { + efi_st_error("ReadKeyStroke failed\n"); + return EFI_ST_FAILURE; + } /* Allow 5 minutes until time out */ boottime->set_watchdog_timer(300, 0, 0, NULL); |