cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

Anonymous
Not applicable

Hi,

I have some code to get data from an IN endpoint on the USB

if ( false == ::DeviceIoControl(h, IOCTL_ADAPT_SEND_NON_EP0_DIRECT,
                        pXmitBuf, iXmitBufSize,
                        data, size,
                        &dwReturnBytes, (LPOVERLAPPED)NULL) )

{

  //throw exception

}

The problem is for the very last transfer, no data is passed back, and I do not want the DeviceIoControl to capture anything. The above code will block until sometthing is captured, but I want it to abandon the last capture. I could successfully do that with the IOCTL_ADAPT_RESET_PARENT_PORT. However, that will NOT result in an excpetion being through, as no error condition is reported.

I tried using IOCTL_ADAPT_ABORT_PIPE to force the above code to throw an exception, however, that does not seems to work. Here is how I implmented the abort function

if (false == ::DeviceIoControl(h, IOCTL_ADAPT_ABORT_PIPE,
                        &Address, sizeof(UCHAR),
                        NULL, 0,
                        &dwBytes, NULL))
                    {
                        throw std::exception("LowCyUsbDriver::Reset() - Input pipe IO request cannot be aborted.");
                    }

Is there another function I can use to force the IOCTL_ADAPT_SEND_NON_EP0_DIRECT to report an error state?

   

 

   

I really need it to report an error state so I know it has returned from the last capture and nothing should be done about the data that was captured.

   

 

   

Thank you!

0 Likes
1 Reply
Anonymous
Not applicable

 Hello,

   

 

   

Marshal.GetLastWin32Error() returns the error code returned by the last unmanaged function that was called. Please have a look at http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getlastwin32error.asp... and also the variuos System error codes at: http://msdn.microsoft.com/en-us/library/ms681381.aspx

   

Please check and let us know whether this proves useful.

   

 

   

Regards,

   

Gayathri

0 Likes