2 * PROJECT: ReactOS USB Hub Driver
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: USBHub debugging functions
5 * COPYRIGHT: Copyright 2017 Vadim Galyant <vgal@rambler.ru>
15 USBHUB_DumpingDeviceDescriptor(IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor
)
17 if (!DeviceDescriptor
)
22 DPRINT("Dumping Device Descriptor - %p\n", DeviceDescriptor
);
23 DPRINT("bLength - %x\n", DeviceDescriptor
->bLength
);
24 DPRINT("bDescriptorType - %x\n", DeviceDescriptor
->bDescriptorType
);
25 DPRINT("bcdUSB - %x\n", DeviceDescriptor
->bcdUSB
);
26 DPRINT("bDeviceClass - %x\n", DeviceDescriptor
->bDeviceClass
);
27 DPRINT("bDeviceSubClass - %x\n", DeviceDescriptor
->bDeviceSubClass
);
28 DPRINT("bDeviceProtocol - %x\n", DeviceDescriptor
->bDeviceProtocol
);
29 DPRINT("bMaxPacketSize0 - %x\n", DeviceDescriptor
->bMaxPacketSize0
);
30 DPRINT("idVendor - %x\n", DeviceDescriptor
->idVendor
);
31 DPRINT("idProduct - %x\n", DeviceDescriptor
->idProduct
);
32 DPRINT("bcdDevice - %x\n", DeviceDescriptor
->bcdDevice
);
33 DPRINT("iManufacturer - %x\n", DeviceDescriptor
->iManufacturer
);
34 DPRINT("iProduct - %x\n", DeviceDescriptor
->iProduct
);
35 DPRINT("iSerialNumber - %x\n", DeviceDescriptor
->iSerialNumber
);
36 DPRINT("bNumConfigurations - %x\n", DeviceDescriptor
->bNumConfigurations
);
41 USBHUB_DumpingConfiguration(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor
)
43 PUSB_COMMON_DESCRIPTOR Descriptor
;
44 PUSB_CONFIGURATION_DESCRIPTOR cDescriptor
;
45 PUSB_INTERFACE_DESCRIPTOR iDescriptor
;
46 PUSB_ENDPOINT_DESCRIPTOR eDescriptor
;
48 if (!ConfigDescriptor
)
53 Descriptor
= (PUSB_COMMON_DESCRIPTOR
)ConfigDescriptor
;
55 while ((ULONG_PTR
)Descriptor
<
56 ((ULONG_PTR
)ConfigDescriptor
+ ConfigDescriptor
->wTotalLength
) &&
59 if (Descriptor
->bDescriptorType
== USB_CONFIGURATION_DESCRIPTOR_TYPE
)
61 cDescriptor
= (PUSB_CONFIGURATION_DESCRIPTOR
)Descriptor
;
63 DPRINT("Dumping cDescriptor - %p\n", cDescriptor
);
64 DPRINT("bLength - %x\n", cDescriptor
->bLength
);
65 DPRINT("bDescriptorType - %x\n", cDescriptor
->bDescriptorType
);
66 DPRINT("wTotalLength - %x\n", cDescriptor
->wTotalLength
);
67 DPRINT("bNumInterfaces - %x\n", cDescriptor
->bNumInterfaces
);
68 DPRINT("bConfigurationValue - %x\n", cDescriptor
->bConfigurationValue
);
69 DPRINT("iConfiguration - %x\n", cDescriptor
->iConfiguration
);
70 DPRINT("bmAttributes - %x\n", cDescriptor
->bmAttributes
);
71 DPRINT("MaxPower - %x\n", cDescriptor
->MaxPower
);
73 else if (Descriptor
->bDescriptorType
== USB_INTERFACE_DESCRIPTOR_TYPE
)
75 iDescriptor
= (PUSB_INTERFACE_DESCRIPTOR
)Descriptor
;
77 DPRINT("Dumping iDescriptor - %p\n", iDescriptor
);
78 DPRINT("bLength - %x\n", iDescriptor
->bLength
);
79 DPRINT("bDescriptorType - %x\n", iDescriptor
->bDescriptorType
);
80 DPRINT("bInterfaceNumber - %x\n", iDescriptor
->bInterfaceNumber
);
81 DPRINT("bAlternateSetting - %x\n", iDescriptor
->bAlternateSetting
);
82 DPRINT("bNumEndpoints - %x\n", iDescriptor
->bNumEndpoints
);
83 DPRINT("bInterfaceClass - %x\n", iDescriptor
->bInterfaceClass
);
84 DPRINT("bInterfaceSubClass - %x\n", iDescriptor
->bInterfaceSubClass
);
85 DPRINT("bInterfaceProtocol - %x\n", iDescriptor
->bInterfaceProtocol
);
86 DPRINT("iInterface - %x\n", iDescriptor
->iInterface
);
88 else if (Descriptor
->bDescriptorType
== USB_ENDPOINT_DESCRIPTOR_TYPE
)
90 eDescriptor
= (PUSB_ENDPOINT_DESCRIPTOR
)Descriptor
;
92 DPRINT("Dumping Descriptor - %p\n", eDescriptor
);
93 DPRINT("bLength - %x\n", eDescriptor
->bLength
);
94 DPRINT("bDescriptorType - %x\n", eDescriptor
->bDescriptorType
);
95 DPRINT("bEndpointAddress - %x\n", eDescriptor
->bEndpointAddress
);
96 DPRINT("bmAttributes - %x\n", eDescriptor
->bmAttributes
);
97 DPRINT("wMaxPacketSize - %x\n", eDescriptor
->wMaxPacketSize
);
98 DPRINT("bInterval - %x\n", eDescriptor
->bInterval
);
102 DPRINT("bDescriptorType - %x\n", Descriptor
->bDescriptorType
);
105 Descriptor
= (PUSB_COMMON_DESCRIPTOR
)((ULONG_PTR
)Descriptor
+
106 Descriptor
->bLength
);
112 USBHUB_DumpingIDs(IN PVOID Id
)
116 ULONG TotalLength
= 0;
119 DPRINT("USBHUB_DumpingIDs:\n");
123 DPRINT(" %S\n", Ptr
);
124 Length
= wcslen(Ptr
) + 1;
127 TotalLength
+= Length
;
130 DPRINT("TotalLength: %hu\n", TotalLength
);