/* Starts transmission of the data on the bulk OUT pipe. Because USB bulk transmissions are quick, this function does not use the overlapped functionality, which means the caller is blocked until the tranmission completed.  */
static uint8_t UblTransmit(uint8_t *data, uint16_t len)
/* Starts transmission of the data on the bulk OUT pipe. Because USB bulk transmissions are quick, this function does not use the overlapped functionality, which means the caller is blocked until the tranmission completed.  */
static uint8_t UblTransmit(uint8_t *data, uint16_t len)
{
  DWORD bytesWritten = 0;
  if (WinUsb_WritePipe(bulkUsbDev.hWinUSBDev, bulkUsbDev.pipeBulkOut, data, len,
                       &bytesWritten, NULL) == 0)
  {
    return UBL_ERROR;
  }
  if (bytesWritten != len)
  {
    return UBL_ERROR;
  }
  return UBL_OKAY;
}