阅读:2118回复:2
ray rang大侠,我的USB驱动昨晚又喊救命!!!!
你好RAY RANG:
我照你说的做了,我看了DW的HELP发现有KUsbInterface::Pipes(index); 随后写了如下代码: class TestDevice : public KPnpDevice { …… KUsbInterface m_Interface; KUsbPipe m_EndpointIn; //MaximumTransferSize can be 0xFFFF. KUsbPipe m_EndpointOut; //MaximumTransferSize can be 0xFFFF. …… } NTSTATUS TestDevice::OnStartDevice(KIrp I) { …… acStatus = m_Lower.ActivateConfiguration( 0, // Configuration 0 2, // Number of endpoints to configure m_Endpoints, // Address of our endpoint table &pTrouble // Gets pointer to problem endpoint (if any) ); PUSBD_PIPE_INFORMATION pusbpipeIn = m_Interface.Pipes( 2 ); PUSBD_PIPE_INFORMATION pusbpipeOut = m_Interface.Pipes( 5 ); pusbpipeIn->MaximumTransferSize = 0xFFF0; pusbpipeOut->MaximumTransferSize = 0xFFF0; …… } NTSTATUS TestDevice::TEST_IOCTL_800_Handler(KIrp I) { NTSTATUS status = STATUS_SUCCESS; t << "Entering TestDevice::TEST_IOCTL_800_Handler, " << I << EOL; // TODO: Verify that the input parameters are correct // If not, return STATUS_INVALID_PARAMETER // TODO: Handle the the TEST_IOCTL_800 request // TODO: Set I.Information to indicate how much // data to copy back to the user. ULONG PipeIn = m_EndpointIn.MaximumTransferSize(); ULONG PipeOut = m_EndpointOut.MaximumTransferSize(); //I.Information() = 0; // Assuming that the request was handled: return status; } 我执行它时在softice4.05看到PipeIn = 0xFFF0, PipeOut = 0xFFF0 ; 但进行写数据时Write( I )里的status照样不为“0”。 我怀疑有两个可能:1>如下代码是不是还没真正实现该配置操作? PUSBD_PIPE_INFORMATION pusbpipeIn = m_Interface.Pipes( 2 ); PUSBD_PIPE_INFORMATION pusbpipeOut = m_Interface.Pipes( 5 ); pusbpipeIn->MaximumTransferSize = 0xFFF0; pusbpipeOut->MaximumTransferSize = 0xFFF0; 2>以下代码是不是还存在不可执行之隐患? dwTotalSize = 0xFFF0; PURB pUrb = m_PipeIn.BuildBulkTransfer(pBuffer , // Where is data coming from? dwTotalSize , // How much data to read? FALSE, // direction (FALSE = OUT) NULL); status = m_PipeIn.SubmitUrb(pUrb, NULL, NULL,4000); 请大侠们赐招, ---------------------------------------------------------------------------------------------------------------------------- |
|
沙发#
发布于:2001-09-18 09:58
应该用KUsbPipe::SetMaximumTransferSize
而且help里面讲的很清楚:一定要在Configure或ActiveConfiguration以前调用才有效。 |
|
|
板凳#
发布于:2001-09-18 12:08
class KUsbPipe
Member Functions KUsbPipe Constructor Type Accessor to pipe type MaximumPacketSize Accessor to maximum packet size EndpointAddress Accessor to endpoint address PollInterval Accessor to polling period Handle Accessor to handle assigned by bus driver MaximumTransferSize Accessor to maximum transfer size Initialize Initialization Reset Reset the pipe Abort Abort the current transfer (?) BuildInterruptTransfer Build an interrupt transfer URB BuildControlTransfer Build a control transfer URB BuildIsochronousTransfer Build an isochronous transfer URB BuildBulkTransfer Build a bulk transfer URB GetStatus Get status of pipe SetFeature Set pipe feature ClearFeature Clear pipe feature BuildClassRequest Build an URB for a class request BuildVendorRequest Build an URB for a vendor request 没见class KUsbPipe::SetMaximumTransferSize这个函数啊! 我用Driverworks2.1开发的,您用的是什么版本的?? 再请您帮帮忙好不好? 感激不尽:) |
|