/* USB standard control transfer support routine. This function is used by USB device. It is possible that the device's interfaces are still waiting to be enumerated. */
EFI_STATUS UsbCtrlRequest(IN USB_DEVICE *UsbDev, IN EFI_USB_DATA_DIRECTION Direction, IN UINTN Type, IN UINTN Target, IN UINTN Request, IN UINT16 Value, IN UINT16 Index, IN OUT VOID *Buf, IN UINTN Length)
/* USB standard control transfer support routine. This function is used by USB device. It is possible that the device's interfaces are still waiting to be enumerated. */
EFI_STATUS UsbCtrlRequest(IN USB_DEVICE *UsbDev, IN EFI_USB_DATA_DIRECTION Direction, IN UINTN Type, IN UINTN Target, IN UINTN Request, IN UINT16 Value, IN UINT16 Index, IN OUT VOID *Buf, IN UINTN Length)
{
  EFI_USB_DEVICE_REQUEST  DevReq;
  EFI_STATUS              Status;
  UINT32                  Result;
  UINTN                   Len;
  ASSERT ((UsbDev != NULL) && (UsbDev->Bus != NULL));
  DevReq.RequestType = USB_REQUEST_TYPE (Direction, Type, Target);
  DevReq.Request     = (UINT8)Request;
  DevReq.Value       = Value;
  DevReq.Index       = Index;
  DevReq.Length      = (UINT16)Length;
  Len    = Length;
  Status = UsbHcControlTransfer (
             UsbDev->Bus,
             UsbDev->Address,
             UsbDev->Speed,
             UsbDev->MaxPacket0,
             &DevReq,
             Direction,
             Buf,
             &Len,
             USB_GENERAL_DEVICE_REQUEST_TIMEOUT,
             &UsbDev->Translator,
             &Result
             );
  return Status;
}