16:34:21.524 DeviceIoControl: 12 bytes written

CloseHandle

16:34:21.634 Close

16:34:21.634 Deselecting configuration

USBDI Structure Reference

This section provides a reference for the USB Driver Interface (USBDI). The basic URB structure has been covered in enough detail in earlier sections of this chapter. Therefore, I first describe various other USBDI structures. Then, I go on to detail each of the URB function codes, the corresponding URB structures and any useful build routines.

Structures

Device Descriptor

A device descriptor is returned in a USB_DEVICE_DESCRIPTOR structure. Table 21.4 shows the fields of interest in the device descriptor. The device class, subclass, and protocol fields are not used by Windows and are often zeroes. However, they may be used to indicate which new common class specification features are used.

Table 21.4 USB DEVICE DESCRIPTOR fields

bDeviceClass bDeviceSubClass bDeviceProtocol The USB class codes
idVendor idProduct bcdDevice Vendor, product, and version numbers
iManufacturer iProduct iSerialNumber Indexes into the string descriptor for the relevant strings
bMaxPacketSize0 The maximum packet size for Endpoint 0
bNumConfigurations The number of configurations

Configuration Descriptor

A configuration descriptor is returned in a USB_CONFIGURATION_DESCRIPTOR structure, with fields as shown in Table 21.5.

A request for a configuration descriptor will also get any other descriptors associated with this configuration (interface-, endpoint-, class-, and vendor-defined descriptors), if there is enough room in your buffer. You will usually get the configuration descriptor twice. First, get the basic USB_CONFIGURATION_DESCRIPTOR structure. The wTotalLength field tells you how big a buffer to allocate to retrieve all the descriptors in your next get configuration request.

Table 21.5 USB CONFIGURATION DESCRIPTOR fields

wTotalLength Total length of all data for the configuration
bNumInterfaces Number of interfaces
iConfiguration Configuration number
bmAttributes bit 5 set: supports remote wake up
bit 6 set: self-powered
bit 7 set: powered from bus
maxPower Maximum power required, in 2mA units

Interface Descriptor

An interface descriptor is returned in a USB_INTERFACE_DESCRIPTOR structure, with fields shown Table 21.6. Interface descriptors are returned as a part of a get configuration descriptor request.

Table 21.6 USB_INTERFACE DESCRIPTOR fields

bInterfaceNumber Interface number
bAlternateSetting Alternate setting
bNumEndpoints Number of endpoints
bInterfaceClass bInterfaceSubClass bInterfaceProtocol USB class codes
iInterface Index of string descriptor describing the interface
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату
×