打印对USB设备配置之后的接口管道信息
2021-11-16
253
7
#define DPRINT DbgPrint
VOID
DumpBusIntefaceInfo(
IN PUSBD_INTERFACE_LIST_ENTRY UsbInterfaceList,
IN ULONG InterfaceCount)
{
ULONG Index, SubIndex;
DPRINT("BusIntefaceInfoCount %lu\n", InterfaceCount);
for (Index = 0; Index < InterfaceCount; Index++)
{
PUSBD_INTERFACE_INFORMATION pInterfaceInfo = UsbInterfaceList[Index].Interface;
DPRINT("---------\n");
DPRINT("InterfaceNumber %1u\n", pInterfaceInfo->InterfaceNumber);
DPRINT("Class:%1u,Protocol:%1u\n", pInterfaceInfo->Class, pInterfaceInfo->Protocol);
for (SubIndex = 0; SubIndex < pInterfaceInfo->NumberOfPipes; SubIndex++)
{
//#define USB_ENDPOINT_TYPE_CONTROL 0x00
//#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
//#define USB_ENDPOINT_TYPE_BULK 0x02
//#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
DPRINT(" EndpointAddress 0x%x\n", pInterfaceInfo->Pipes[SubIndex].EndpointAddress);
DPRINT(" PipeType 0x%x\n", pInterfaceInfo->Pipes[SubIndex].PipeType);
DPRINT(" MaxPacketSize 0x%x\n", pInterfaceInfo->Pipes[SubIndex].MaximumPacketSize);
DPRINT(" Interval 0x%x\n", pInterfaceInfo->Pipes[SubIndex].Interval);
DPRINT(" Handle 0x%p\n", pInterfaceInfo->Pipes[SubIndex].PipeHandle);
DPRINT(" MaximumTransferSize 0x%x\n", pInterfaceInfo->Pipes[SubIndex].MaximumTransferSize);
DPRINT("\n");
}
}
};
输出的内容如下:
3: kd> p
BusIntefaceInfoCount 3
---------
InterfaceNumber 0
Class:3,Protocol:255
EndpointAddress 0x81
PipeType 0x3
MaxPacketSize 0x1f3
Interval 0x1
Handle 0xFFFFDF086BD39C40
MaximumTransferSize 0x400000
EndpointAddress 0x1
PipeType 0x3
MaxPacketSize 0x1f3
Interval 0x1
Handle 0xFFFFDF08E8105BD0
MaximumTransferSize 0x400000
---------
InterfaceNumber 1
Class:14,Protocol:0
EndpointAddress 0x82
PipeType 0x3
MaxPacketSize 0x10
Interval 0x1
Handle 0xFFFFDF086BFBF5F0
MaximumTransferSize 0x400000
---------
InterfaceNumber 2
Class:14,Protocol:0
EndpointAddress 0x83
PipeType 0x2
MaxPacketSize 0x200
Interval 0x0
Handle 0xFFFFDF08E86F06B0
MaximumTransferSize 0x400000
说明:
- MaximumTransferSize这个字段在Windows xp,windows 2003这些操作系统包括之后的操作系统该字段将不再使用。
- 对于WinUsb为了确定 MAXIMUM_TRANSFER_SIZE可以使用函数 WinUsb_GetPipePolicy.
- 参考资料:USBD_PIPE_INFORMATION structure
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936