VOID
UsbSamp_EvtIoRead(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t Length
)
/*++
Routine Description:
Called by the framework when it receives Read requests.
Arguments:
Queue - Default queue handle
Request - Handle to the read/write request
Lenght - Length of the data buffer associated with the request.
The default property of the queue is to not dispatch
zero lenght read & write requests to the driver and
complete is with status success. So we will never get
a zero length request.
Return Value:
--*/
{
PFILE_CONTEXT fileContext = NULL;
WDFUSBPIPE pipe;
WDF_USB_PIPE_INFORMATION pipeInfo;
PAGED_CODE();
//
// Get the pipe associate with this request.
//
fileContext = GetFileContext(WdfRequestGetFileObject(Request));
pipe = fileContext->Pipe;
if (pipe == NULL) {
UsbSamp_DbgPrint(1, ("pipe handle is NULL\n"));
WdfRequestCompleteWithInformation(Request, STATUS_INVALID_PARAMETER, 0);
return;
}
WDF_USB_PIPE_INFORMATION_INIT(&pipeInfo);
WdfUsbTargetPipeGetInformation(pipe, &pipeInfo);
if((WdfUsbPipeTypeBulk == pipeInfo.PipeType) ||
(WdfUsbPipeTypeInterrupt == pipeInfo.PipeType)) {
ReadWriteBulkEndPoints(Queue, Request, (ULONG) Length, WdfRequestTypeRead);
return;
} else if(WdfUsbPipeTypeIsochronous == pipeInfo.PipeType){
#if !defined(BUFFERED_READ_WRITE) // if doing DIRECT_IO
ReadWriteIsochEndPoints(Queue, Request, (ULONG) Length, WdfRequestTypeRead);
return;
#endif
}
UsbSamp_DbgPrint(1, ("ISO transfer is not supported for buffered I/O transfer\n"));
WdfRequestCompleteWithInformation(Request, STATUS_INVALID_DEVICE_REQUEST, 0);
return;
} |