USB Device Descriptors
The device descriptor contains information about a USB device as a
whole. To obtain the device descriptor, use
UsbBuildGetDescriptorRequest to build the USB request block (URB)
for the request.
For example, the following call fills in the buffer at pURB with
the appropriate URB. UsbBuildGetDescriptorRequest(
pURB, // points to the URB to be filled in
sizeof(_URB_CONTROL_DESCRIPTOR_REQUEST),
USB_DEVICE_DESCRIPTOR_TYPE,
0, // this parameter not used for device descriptors
0, // this parameter not used for device descriptors
pDescriptor, // points to a USB_DEVICE_DESCRIPTOR
NULL,
sizeof(USB_DEVICE_DESCRIPTOR),
NULL
);
See IOCTL_INTERNAL_USB_SUBMIT_URB
for a description of how to submit the URB to the bus driver. Once the bus
driver completes the IRP for the request, it returns a USB_DEVICE_DESCRIPTOR
in the buffer beginning at pDescriptor.
To determine the number of configurations a device supports, check the
bNumConfigurations member of the returned structure.
|