如何构建一个虚拟的 USBD_PIPE_HANDLE PipeHandle ?
我写了一个可以虚拟任何USB设备的总线驱动,应用层已能正常将URB读出、写入到此总线驱动。
在虚拟的USB设备中,存在两个Pipe:一个out,一个in。
在收到上层驱动发下来的URB时,它要求查询接口描述符(USB_INTERFACE_DESCRIPTOR_TYPE),回复给它的必须有out和in这两个Pipe的信息。
在pipe的信息中:
Interface[0]: Pipes[0] : MaximumPacketSize = 0x00000040
Interface[0]: Pipes[0] : EndpointAddress = 0x00000081 (endpoint 0x00000081,方向:IN)
Interface[0]: Pipes[0] : Interval = 0x00000000
Interface[0]: Pipes[0] : PipeType = 0x00000002 (UsbdPipeTypeBulk)
Interface[0]: Pipes[0] : PipeHandle = 0x88ae4294
Interface[0]: Pipes[0] : MaxTransferSize = 0xffffffff
Interface[0]: Pipes[0] : PipeFlags = 0x00000000
Interface[0]: Pipes[1] : MaximumPacketSize = 0x00000040
Interface[0]: Pipes[1] : EndpointAddress = 0x00000002 (endpoint 0x00000002,方向:OUT)
Interface[0]: Pipes[1] : Interval = 0x00000000
Interface[0]: Pipes[1] : PipeType = 0x00000002 (UsbdPipeTypeBulk)
Interface[0]: Pipes[1] : PipeHandle = 0x88ae42b4
Interface[0]: Pipes[1] : MaxTransferSize = 0xffffffff
Interface[0]: Pipes[1] : PipeFlags = 0x00000000
在这两个PIPE中,除了PipeHandle之外,其它的好设置。
因为我这个是虚拟的USB,两个PIPE的PipeHandle我不知如何生成。随便设置一个的话,会导致蓝屏,上面的驱动需要使用它来操作这两个PIPE。
文档上只写了PipeHandle是由HCD返回来的,但具体是怎么生成的,我一无所知。
最终问题:
虚拟USB设备的这个PipeHandle该如何正确生成?