Example #1
0
        private int StmSubmitWrite(KSTM_INFO info,
                                   KSTM_XFER_CONTEXT xferContext,
                                   int xferContextIndex,
                                   IntPtr nativeOverlapped)
        {
            int notUsedForAsync;
            int bufferSize = xferContext.TransferLength;

            bool success = mUsb.WritePipe(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;
        }
Example #2
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;
 }