Windows驱动开发USB
+ -

打印对USB设备配置之后的接口管道信息

2021-11-16 13 0
#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

0 篇笔记 写笔记

打印对USB设备配置之后的接口管道信息
#define DPRINT DbgPrintVOIDDumpBusIntefaceInfo( IN PUSBD_INTERFACE_LIST_ENTRY UsbInterfaceList, IN ULONG InterfaceCount){ ULONG Index,......
作者信息
USB中文网
Windows驱动开发,网站开发
好好学习,天天向上。
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

您的支持,是我们前进的动力!