1 Reply Latest reply on Nov 9, 2011 1:37 AM by GayathriV_16

    IOCTL_ADAPT_SEND_NON_EP0_DIRECT (input) how to tell if the pipe was reset and/or aborted??


      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!