/* Wait for a key to be pressed by user. */
EFI_STATUS WaitForKeyStroke(OUT EFI_INPUT_KEY *Key)
/* Wait for a key to be pressed by user. */
EFI_STATUS WaitForKeyStroke(OUT EFI_INPUT_KEY *Key)
{
  EFI_STATUS  Status;
  UINTN       Index;
  while (TRUE) {
    Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
    if (!EFI_ERROR (Status)) {
      break;
    }
    if (Status != EFI_NOT_READY) {
      continue;
    }
    gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &Index);
  }
  return Status;
}