Hi,
I have find a possible solution:
In function USB_DeviceControlCallback() on usb_device_ch9.c I changed
status = USB_DeviceRecvRequest(handle, USB_CONTROL_ENDPOINT, buffer, deviceSetup->wLength);
return status;
to
/* Prepare controlRequest to upper layer */
usb_device_control_request_struct_t controlRequest;
controlRequest.buffer = buffer;
controlRequest.isSetup = 0U;
controlRequest.setup = deviceSetup;
controlRequest.length = deviceSetup->wLength;
/* Prime an OUT transfer */
status = USB_DeviceRecvRequest(handle, USB_CONTROL_ENDPOINT, buffer, deviceSetup->wLength);
if(status != kStatus_USB_Success)
{
return status;
}
/* Send controlRequest to upper layer */
status = USB_DeviceClassCallback(handle, (uint32_t)kUSB_DeviceEventVendorRequest, &controlRequest);
return status;
Case kUSB_DeviceClassEventClassRequest/USB_DEVICE_VIDEO_SET_REQUEST_INTERFACE in USB_DeviceVideoEvent() in usb_device_video.c
In function USB_DeviceVideoEvent() on usb_device_video.c in subcase USB_DEVICE_VIDEO_SET_REQUEST_INTERFACE of kUSB_DeviceClassEventClassRequest case I changed
case USB_DEVICE_VIDEO_SET_REQUEST_INTERFACE:
if (0U != controlRequest->isSetup)
{
/* Get the buffer to receive the data sent from the host. */
if ((NULL != videoHandle->configStruct) && (NULL != videoHandle->configStruct->classCallback))
{
/*ClassCallback is initialized in classInit of s_UsbDeviceClassInterfaceMap,
it is from the second parameter of classInit*/
error = videoHandle->configStruct->classCallback(
(class_handle_t)videoHandle, kUSB_DeviceVideoEventClassRequestBuffer, controlRequest);
}
}
break;
to
case USB_DEVICE_VIDEO_SET_REQUEST_INTERFACE:
if (0U != controlRequest->isSetup)
{
/* Get the buffer to receive the data sent from the host. */
if ((NULL != videoHandle->configStruct) && (NULL != videoHandle->configStruct->classCallback))
{
/*ClassCallback is initialized in classInit of s_UsbDeviceClassInterfaceMap,
it is from the second parameter of classInit*/
error = videoHandle->configStruct->classCallback(
(class_handle_t)videoHandle, kUSB_DeviceVideoEventClassRequestBuffer, controlRequest);
}
}
else
{
if (videoHandle->streamInterfaceNumber == interface_index)
{
error = USB_DeviceVideoVsRequest(videoHandle, controlRequest);
}
}
break;
Thank, regards,
M.P.