mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-27 04:47:20 +00:00
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>
This commit is contained in:
parent
0dfd13a4c8
commit
1d69c8d850
1 changed files with 24 additions and 3 deletions
|
@ -40,15 +40,36 @@ static int execute(void)
|
||||||
{
|
{
|
||||||
struct efi_input_key input_key = {0};
|
struct efi_input_key input_key = {0};
|
||||||
efi_status_t ret;
|
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("Waiting for your input\n");
|
||||||
efi_st_printf("To terminate type 'x'\n");
|
efi_st_printf("To terminate type 'x'\n");
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Wait for next key */
|
/* Wait for next key */
|
||||||
do {
|
ret = boottime->wait_for_event(1, &con_in->wait_for_key,
|
||||||
ret = con_in->read_key_stroke(con_in, &input_key);
|
&index);
|
||||||
} while (ret == EFI_NOT_READY);
|
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 */
|
/* Allow 5 minutes until time out */
|
||||||
boottime->set_watchdog_timer(300, 0, 0, NULL);
|
boottime->set_watchdog_timer(300, 0, 0, NULL);
|
||||||
|
|
Loading…
Add table
Reference in a new issue