I use the following code to write to an Interrupt pipe:
***
//* write a command to the hardware *
WDF_REQUEST_SEND_OPTIONS_INIT(&sendop, 0);
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&sendop, WDF_REL_TIMEOUT_IN_SEC(OP_TIMEOUT));
bytesWritten = 0;
status = WdfUsbTargetPipeWriteSynchronously(
devCtx->UsbInterruptOutPipe,
0,
&sendop,
&memDin,
&bytesWritten);
if(!NT_SUCCESS(status)) {
KdPrint((_DN “WdfUsbTargetPipeWriteSynchronously FAILED! (0x%08x)\n”, status));
WdfRequestComplete(Request, STATUS_UNSUCCESSFUL);
return;
} else {
KdPrint((_DN “Wrote %lu bytes\n”, bytesWritten));
}
***
On return, bytesWritten is usually some outrageous value, such as 3141533696. I’m pretty sure I’m doing this like the example in the WDK shows, and I’m pretty sure I have the write formatting in the KdPrint statement, so I don’t see how else I could be messing this one up.
FWIW, I see the same results in the equivalent read function.
Is there a problem in the framework or am I missing some obvious bug?
jorj