/* Read several bytes from the scancode buffer without removing them. This function is called to see if there are enough bytes of scancode representing a single key. */
EFI_STATUS GetScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf)
/* Read several bytes from the scancode buffer without removing them. This function is called to see if there are enough bytes of scancode representing a single key. */
EFI_STATUS GetScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf)
{
  UINTN  Index;
  UINTN  Pos;
  if (GetScancodeBufCount (Queue) < Count) {
    return EFI_NOT_READY;
  }
  for (Index = 0, Pos = Queue->Head; Index < Count; Index++, Pos = (Pos + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT) {
    Buf[Index] = Queue->Buffer[Pos];
  }
  return EFI_SUCCESS;
}