阅读:1218回复:1
想定时查询USB端口信息问题,在线等待回答(送分)
想定时查询USB端口信息,在定时调用程序中实现如下代码函数BulkReadData,用Softice调试,发现语句
pipe->SubmitUrb(pUrb,NULL,NULL,100); 不能运行在Dispatch_Level优先级,那么,我该如何实现定时查询 管道信息呢? 关于BulkReadData代码如下: ULONG EzUsbDevice::BulkReadData(int pipeNum, PVOID pBuffer, ULONG dataLen) { t << \"Entering BulkReadWrite\\n\"; ULONG RetValue = 0; NTSTATUS status = STATUS_SUCCESS; //PBULK_TRANSFER_CONTROL p = reinterpret_cast<PBULK_TRANSFER_CONTROL>(pBuffer); ULONG nBufferLength = dataLen; KUsbPipe* pipe = FindPipe(pipeNum); if(NULL == pipe) { t << \"Error: Invalid pipe parameter\\n\"; return STATUS_INVALID_PARAMETER; } if( nBufferLength > pipe->MaximumTransferSize() ) { t << \"Error: Invalid transfer size parameter\" << pipe->MaximumTransferSize() << \"\\n\"; return STATUS_INVALID_PARAMETER; } //KMemory M( I.Mdl() ); PURB pUrb = pipe->BuildBulkTransfer( pBuffer,//M, nBufferLength, TRUE,//static_cast<BOOLEAN>( USB_ENDPOINT_DIRECTION_IN(pipe->EndpointAddress()) ), NULL, TRUE ); //status = pipe->SubmitUrb(pUrb); status = pipe->SubmitUrb(pUrb,NULL,NULL,100);//chen if(STATUS_TIMEOUT == status ) { status = pipe->Abort(); RetValue = 0; //status = pipe->Reset(); } else if( STATUS_SUCCESS == status ) { RetValue = pUrb->UrbBulkOrInterruptTransfer.TransferBufferLength; t << \"RetValue\" << RetValue << \"\\n\"; } delete pUrb; return RetValue; } |
|
沙发#
发布于:2002-07-26 00:48
If CompletionRoutine is NULL, SubmitUrb does not return until the request is complete. To achieve this, it must wait on a synchronization event. Therefore, the synchronous call can be made only at PASSIVE_LEVEL, and ////////preferably in non-arbitrary thread context./////
|
|