ReactOS 0.4.15-dev-8058-ga7cbb60
debug.c
Go to the documentation of this file.
1/*
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>
6 */
7
8#include "usbhub.h"
9
10#define NDEBUG
11#include <debug.h>
12
13VOID
16{
18 {
19 return;
20 }
21
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);
37}
38
39VOID
42{
45 PUSB_INTERFACE_DESCRIPTOR iDescriptor;
46 PUSB_ENDPOINT_DESCRIPTOR eDescriptor;
47
49 {
50 return;
51 }
52
54
55 while ((ULONG_PTR)Descriptor <
56 ((ULONG_PTR)ConfigDescriptor + ConfigDescriptor->wTotalLength) &&
57 Descriptor->bLength)
58 {
59 if (Descriptor->bDescriptorType == USB_CONFIGURATION_DESCRIPTOR_TYPE)
60 {
62
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);
72 }
73 else if (Descriptor->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE)
74 {
76
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);
87 }
88 else if (Descriptor->bDescriptorType == USB_ENDPOINT_DESCRIPTOR_TYPE)
89 {
91
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);
99 }
100 else
101 {
102 DPRINT("bDescriptorType - %x\n", Descriptor->bDescriptorType);
103 }
104
106 Descriptor->bLength);
107 }
108}
109
110VOID
111NTAPI
113{
114 PWSTR Ptr;
115 size_t Length;
116 size_t TotalLength = 0;
117
118 Ptr = Id;
119 DPRINT("USBHUB_DumpingIDs:\n");
120
121 while (*Ptr)
122 {
123 DPRINT(" %S\n", Ptr);
124 Length = wcslen(Ptr) + 1;
125
126 Ptr += Length;
128 }
129
130 DPRINT("TotalLength: %Iu\n", TotalLength);
131 DPRINT("\n");
132}
DWORD Id
#define ULONG_PTR
Definition: config.h:101
VOID NTAPI USBHUB_DumpingIDs(IN PVOID Id)
Definition: debug.c:112
VOID NTAPI USBHUB_DumpingConfiguration(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor)
Definition: debug.c:41
VOID NTAPI USBHUB_DumpingDeviceDescriptor(IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor)
Definition: debug.c:15
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define DPRINT
Definition: sndvol32.h:71
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257
uint16_t * PWSTR
Definition: typedefs.h:56
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
struct _USB_CONFIGURATION_DESCRIPTOR * PUSB_CONFIGURATION_DESCRIPTOR
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usb100.h:50
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usb100.h:53
struct _USB_INTERFACE_DESCRIPTOR * PUSB_INTERFACE_DESCRIPTOR
struct _USB_COMMON_DESCRIPTOR * PUSB_COMMON_DESCRIPTOR
struct _USB_ENDPOINT_DESCRIPTOR * PUSB_ENDPOINT_DESCRIPTOR
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usb100.h:52
_In_ ULONG TotalLength
Definition: usbdlib.h:158
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID ConfigDescriptor
Definition: wdfusb.h:1036