Changeset View
Changeset View
Standalone View
Standalone View
head/sys/boot/efi/libefi/efi_console.c
Show First 20 Lines • Show All 432 Lines • ▼ Show 20 Lines | |||||
efi_cons_getchar() | efi_cons_getchar() | ||||
{ | { | ||||
EFI_INPUT_KEY key; | EFI_INPUT_KEY key; | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
UINTN junk; | UINTN junk; | ||||
/* Try to read a key stroke. We wait for one if none is pending. */ | /* Try to read a key stroke. We wait for one if none is pending. */ | ||||
status = conin->ReadKeyStroke(conin, &key); | status = conin->ReadKeyStroke(conin, &key); | ||||
if (status == EFI_NOT_READY) { | while (status == EFI_NOT_READY) { | ||||
/* Some EFI implementation (u-boot for example) do not support WaitForKey */ | |||||
if (conin->WaitForKey != NULL) | |||||
BS->WaitForEvent(1, &conin->WaitForKey, &junk); | BS->WaitForEvent(1, &conin->WaitForKey, &junk); | ||||
status = conin->ReadKeyStroke(conin, &key); | status = conin->ReadKeyStroke(conin, &key); | ||||
} | } | ||||
switch (key.ScanCode) { | switch (key.ScanCode) { | ||||
case 0x17: /* ESC */ | case 0x17: /* ESC */ | ||||
return (0x1b); /* esc */ | return (0x1b); /* esc */ | ||||
} | } | ||||
/* this can return */ | /* this can return */ | ||||
return (key.UnicodeChar); | return (key.UnicodeChar); | ||||
} | } | ||||
int | int | ||||
efi_cons_poll() | efi_cons_poll() | ||||
{ | { | ||||
if (conin->WaitForKey == NULL) | |||||
return (1); | |||||
/* This can clear the signaled state. */ | /* This can clear the signaled state. */ | ||||
return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS); | return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS); | ||||
} | } | ||||
/* Plain direct access to EFI OutputString(). */ | /* Plain direct access to EFI OutputString(). */ | ||||
void | void | ||||
efi_cons_efiputchar(int c) | efi_cons_efiputchar(int c) | ||||
{ | { | ||||
Show All 29 Lines |