TOP OUTSIDE OF efi_main(...){...}你应该添加EFI_INPUT_KEY 键;
在 efi_main之后,
#if defined(_GNU_EFI)
InitializeLib(ImageHandle, SystemTable);
#endif
添加UINTN 键事件 = 0;
或者无论你的方式是...
Print(L"PRESS ANY KEY OR PLEASE PRESS ESC TO EXIT.%N\n");
uefi_call_wrapper(SystemTable->ConOut->OutputString, 1, SystemTable->ConOut, L"START KEY READ\n"); // YES WE COULD DO SIMPLY Print(...);
SystemTable->ConIn->Reset(SystemTable->ConIn, FALSE);
//NOW WE SHOULD READ SOME KEYS
//YOU CAN ADD ANY OTHER OPTION HERE, WHEN CAPSLOCK ON THAT WILL PRINT FIRST CHAR CAPITALIZED BUT NOT REST OF CHARACTERS SINCE WE RESET...
//IF YOU WANT MORE KEYS SIMPLY IN VISUAL STUDIO TYPE SCAN_ AND YOU WILL SEE OTHER KEYS
/*...OTHER...*/
while ((UINTN)Key.ScanCode != SCAN_ESC)
{
SystemTable->BootServices->WaitForEvent(1, &SystemTable->ConIn->WaitForKey, &KeyEvent);
SystemTable->ConIn->ReadKeyStroke(SystemTable->ConIn, &Key);
SystemTable->ConIn->Reset(SystemTable->ConIn, FALSE);
Print(L"%c", Key.UnicodeChar);
}
/*...OTHER...*/
SystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
return EFI_SUCCESS;