示例#1
0
 private int StmComplete(KSTM_INFO stmInfo, KSTM_XFER_CONTEXT xferContext, int stmXferContextIndex, int errorCode)
 {
     Debug.WriteLineIf(errorCode != ErrorCodes.Success,
                       String.Format("Failed completing transfer. PipeID:{0:X2}h ErrorCode:{1:X8}h",
                                     mPipeId,
                                     errorCode),
                       "ERROR");
     return(errorCode);
 }
示例#2
0
        private int StmSubmitRead(KSTM_INFO info,
                                  KSTM_XFER_CONTEXT xferContext,
                                  int xferContextIndex,
                                  IntPtr nativeOverlapped)
        {
            int notUsedForAsync;
            int bufferSize = xferContext.BufferSize;

            bool success   = mUsb.ReadPipe(mPipeId, xferContext.Buffer, bufferSize, out notUsedForAsync, nativeOverlapped);
            int  errorCode = Marshal.GetLastWin32Error();

            if (!success && errorCode == ErrorCodes.IoPending)
            {
                return(ErrorCodes.Success);
            }

            Debug.WriteLine(
                String.Format("Failed submitting transfer. PipeID:{0:X2}h ErrorCode:{1:X8}h",
                              mPipeId,
                              errorCode),
                "ERROR");
            return(errorCode);
        }