/* Read & remove several bytes from the scancode buffer. This function is usually called after  */
EFI_STATUS PopScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf OPTIONAL)
/* Read & remove several bytes from the scancode buffer. This function is usually called after  */
EFI_STATUS PopScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf OPTIONAL)
{
  UINTN  Index;
  if (GetScancodeBufCount (Queue) < Count) {
    return EFI_NOT_READY;
  }
  for (Index = 0; Index < Count; Index++, Queue->Head = (Queue->Head + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT) {
    if (Buf != NULL) {
      Buf[Index] = Queue->Buffer[Queue->Head];
    }
  }
  return EFI_SUCCESS;
}