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;
}
请问这函数中是怎么识别管道传输和登时传输的,文中我能看得懂。但是在上位机程序中我们调用了readfile,可是readfile没有传递相关的管道信息呀,奇怪。我觉得至少应该给一个参数说明是用的哪种传输方式和管道,端点。小弟有些疑惑请知道帮一下。谢谢 |