阅读:905回复:0
在驱程里实现中断传输的多个子节连续传输,有问题!
我在驱程里是这样写的:NTSTATUS D12_DriverDevice::D12_DRIVER_READ_Handler(KIrp I)
{ PURB pUrb; NTSTATUS status; if (I.IoctlOutputBufferSize() == 0) { I.Information() = 0; return I.PnpComplete(this, STATUS_SUCCESS); } ULONG dwTotalSize = I.IoctlInputBufferSize(CURRENT); ASSERT(dwTotalSize); ULONG dwBytesRead = 0; pUrb = m_Endpoint1In.BuildInterruptTransfer( (unsigned char *)I.IoctlBuffer(), // transfer buffer I.IoctlInputBufferSize(), // transfer buffer size TRUE, // Short Ok NULL, // link urb NULL // new urb ); if ( pUrb != NULL) { status = m_Endpoint1In.SubmitUrb(pUrb, NULL, NULL,300); if ( NT_SUCCESS(status) ) { dwBytesRead = pUrb->UrbBulkOrInterruptTransfer.TransferBufferLength; if (dwBytesRead > 0) t << "Read got " << dwTotalSize << " bytes from USB\n"; } delete pUrb; } else { status=STATUS_INSUFFICIENT_RESOURCES; } I.Information() = dwBytesRead; return status; } |
|