/* Internal function to read the next keystroke from the keyboard buffer. */
EFI_STATUS USBKeyboardReadKeyStrokeWorker(IN OUT USB_KB_DEV *UsbKeyboardDevice, OUT EFI_KEY_DATA *KeyData)
/* Internal function to read the next keystroke from the keyboard buffer. */
EFI_STATUS USBKeyboardReadKeyStrokeWorker(IN OUT USB_KB_DEV *UsbKeyboardDevice, OUT EFI_KEY_DATA *KeyData)
{
  if (KeyData == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  if (IsQueueEmpty (&UsbKeyboardDevice->EfiKeyQueue)) {
    ZeroMem (&KeyData->Key, sizeof (KeyData->Key));
    InitializeKeyState (UsbKeyboardDevice, &KeyData->KeyState);
    return EFI_NOT_READY;
  }
  Dequeue (&UsbKeyboardDevice->EfiKeyQueue, KeyData, sizeof (*KeyData));
  return EFI_SUCCESS;
}