阅读:1523回复:4
SubmitUrb出错,怎搞
使用DriverStudio生成的代码
只有Bulk传输 读写时都死机 用SoftIce跟踪发现问题出在SubmitUrb上 请问高手怎搞 工作环境:win2k 下面是写操作的代码 NTSTATUS Dirver6Device::Write(KIrp I) { t << \"Entering Dirver6Device::Write, \" << I << EOL; // TODO: Check the incoming request. Replace \"FALSE\" in the following // line with a check that returns TRUE if the request is not valid. if (FALSE) { // Invalid parameter in the Write request I.Information() = 0; return I.PnpComplete(this, STATUS_INVALID_PARAMETER); } // Always ok to write 0 elements. if (I.WriteSize() == 0) { I.Information() = 0; return I.PnpComplete(this, STATUS_SUCCESS); } ULONG dwTotalSize = I.WriteSize(CURRENT); ULONG dwMaxSize = m_Endpoint2OUT.MaximumTransferSize(); // If the total requested read size is greater than the Maximum Transfer // Size for the Pipe, request to read only the Maximum Transfer Size since // the bus driver will fail an URB with a TransferBufferLength of greater // than the Maximum Transfer Size. if (dwTotalSize > dwMaxSize) { ASSERT(dwMaxSize); dwTotalSize = dwMaxSize; } // Declare a memory object KMemory Mem(I.Mdl()); // Allocate a new context structure for Irp completion USB_COMPLETION_INFO* pCompInfo = new (NonPagedPool) USB_COMPLETION_INFO; if (pCompInfo == NULL) { I.Information() = 0; return I.PnpComplete(this, STATUS_INSUFFICIENT_RESOURCES); } // TODO: Select the correct pipe to write to // Create an URB to do actual Bulk write to the pipe PURB pUrb = m_Endpoint2OUT.BuildBulkTransfer( Mem, // Where is data coming from? dwTotalSize, // How much data to read? FALSE, // direction (FALSE = OUT) NULL // Link to next URB ); if (pUrb == NULL) { delete pCompInfo; I.Information() = 0; return I.PnpComplete(this, STATUS_INSUFFICIENT_RESOURCES); } // Initialize context structure pCompInfo->m_pClass = this; pCompInfo->m_pUrb = pUrb; // Submit the URB to our USB device NTSTATUS status; status = m_Endpoint2OUT.SubmitUrb(I, pUrb, LinkTo(WriteComplete), pCompInfo, 0); return status; } |
|
沙发#
发布于:2002-11-09 19:56
用仿真看一下,设备到底收到了多少数据,是否出现丢数据的现象。
|
|
|
板凳#
发布于:2002-11-09 21:00
谢谢先
确实没有数据丢失 我现在在DS生成代码的时候选用ClassGUID就不死机了 以前是openbyname (这是怎么一回事,有高手知道顺便告知) 但是新问题是只能实现写功能 读操作时 IN07IRQ的相应位也没有置一 请指点 |
|
地板#
发布于:2002-11-10 09:16
DS2.5 2.6的BUG!
|
|
|
地下室#
发布于:2002-11-10 16:11
问题解决了
换了ds2.7果然就好了 谢谢 如何给分? |
|