B.5. USB Data Types

The types described in this section are declared in the WinDriver/include/windrvr.h header file, unless otherwise specified in the documentation.

B.5.1. WD_DEVICE_REGISTRY_PROPERTY Enumeration

Enumeration of device registry property identifiers.
String properties are returned in NULL-terminated WCHAR array format.

[Note]
For more information regarding the properties described in this enumaration, refer to the description of the Windows IoGetDeviceProperty() function's DeviceProperty parameter in the Microsoft Development Network (MSDN) documentation.
Enum ValueDescription
WdDevicePropertyDeviceDescriptionDevice description
WdDevicePropertyHardwareIDThe device's hardware IDs
WdDevicePropertyCompatibleIDsThe device's compatible IDs
WdDevicePropertyBootConfiguration The hardware resources assigned to the device by the firmware, in raw data form
WdDevicePropertyBootConfigurationTranslated The hardware resources assigned to the device by the firmware, in translated form
WdDevicePropertyClassNameThe name of the device's setup class, in text format
WdDevicePropertyClassGuidThe GUID for the device's setup class (string format)
WdDevicePropertyDriverKeyNameThe name of the driver-specific registry key
WdDevicePropertyManufacturerDevice manufacturer string
WdDevicePropertyFriendlyName Friendly device name (typically defined by the class installer), which can be used to distinguish between two similar devices
WdDevicePropertyLocationInformation Information about the device's Location on the bus (string format).
The interpertation of this information is bus-specific.
WdDevicePropertyPhysicalDeviceObjectName The name of the Physical Device Object (PDO) for the device
WdDevicePropertyBusTypeGuidThe GUID for the bus to which the device is connected
WdDevicePropertyLegacyBusTypeThe bus type (e.g., PCIBus)
WdDevicePropertyBusNumber The legacy bus number of the bus to which the device is connected
WdDevicePropertyEnumeratorNameThe name of the device's enumerator (e.g., "PCI" or "root")
WdDevicePropertyAddress The device's bus address.
The interpertation of this address is bus-specific.
WdDevicePropertyUINumber A number associated with the device that can be displayed in the user interface
WdDevicePropertyInstallStateThe device's installation state
WdDevicePropertyRemovalPolicyThe device's current removal policy (Windows 7 and higher)

B.5.2. USB Structures

The following figure depicts the structure hierarchy used by WinDriver's USB API. The arrays situated in each level of the hierarchy may contain more elements than are depicted in the diagram. Arrows are used to represent pointers. In the interest of clarity, only one structure at each level of the hierarchy is depicted in full detail (with all of its elements listed and pointers from it pictured).

Figure B.2. WinDriver USB Structures

WinDriver USB Structures

B.5.2.1. WDU_MATCH_TABLE Structure

USB match table structure.

[Note]
(*) For all field members, if value is set to zero — match all.
FieldTypeDescription
wVendorIdWORDRequired USB Vendor ID to detect, as assigned by USB-IF (*)
wProductIdWORD Required USB Product ID to detect, as assigned by the product manufacturer (*)
bDeviceClassBYTEThe device's class code, as assigned by USB-IF (*)
bDeviceSubClassBYTEThe device's sub-class code, as assigned by USB-IF (*)
bInterfaceClassBYTEThe interface's class code, as assigned by USB-IF (*)
bInterfaceSubClassBYTEThe interface's sub-class code, as assigned by USB-IF (*)
bInterfaceProtocolBYTEThe interface's protocol code, as assigned by USB-IF (*)

B.5.2.2. WDU_EVENT_TABLE Structure

USB events table structure.
This structure is defined in WinDriver/include/wdu_lib.h.

FieldTypeDescription
pfDeviceAttachWDU_ATTACH_CALLBACKWill be called by WinDriver when a device is attached
pfDeviceDetachWDU_DETACH_CALLBACKWill be called by WinDriver when a device is detached
pfPowerChangeWDU_POWER_CHANGE_CALLBACK Will be called by WinDriver when there is a change in a device's power state
pUserDataPVOIDPointer to user-mode data to be passed to the callbacks

B.5.2.3. WDU_DEVICE Structure

USB device information structure.

FieldTypeDescription
DescriptorWDU_DEVICE_DESCRIPTOR Device descriptor information structure [B.5.2.7]
Pipe0WDU_PIPE_INFO Pipe information structure [B.5.2.11] for the device's default control pipe (pipe 0)
pConfigsWDU_CONFIGURATION* Pointer to the beginning of an array of configuration information structures [B.5.2.4] describing the device's configurations
pActiveConfigWDU_CONFIGURATION* Pointer to the device's active configuration information structure [B.5.2.4], stored in the pConfigs array
pActiveInterface WDU_INTERFACE*
[WD_USB_MAX_INTERFACES]
Array of pointers to interface information structures [B.5.2.5]; the non-NULL elements in the array represent the device's active interfaces.
On Windows, the number of active interfaces is the number of interfaces supported by the active configuration, as stored in the pActiveConfig->dwNumInterfaces field.
On Linux, the number of active interfaces is currently always 1, because the WDU_ATTACH_CALLBACK device-attach callback [B.3.1] is called for each device interface.

B.5.2.4. WDU_CONFIGURATION Structure

Configuration information structure.

FieldTypeDescription
DescriptorWDU_CONFIGURATION_DESCRIPTOR Configuration descriptor information structure [B.5.2.8]
dwNumInterfacesDWORDNumber of interfaces supported by this configuration
pInterfacesWDU_INTERFACE* Pointer to the beginning of an array of interface information structures [B.5.2.5] for the configuration's interfaces

B.5.2.5. WDU_INTERFACE Structure

Interface information structure.

FieldTypeDescription
pAlternateSettingsWDU_ALTERNATE_SETTING* Pointer to the beginning of an array of alternate setting information structures [B.5.2.6] for the interface's alternate settings
dwNumAltSettingsDWORDNumber of alternate settings supported by this interface
pActiveAltSettingWDU_ALTERNATE_SETTING* Pointer to an alternate setting information structure [B.5.2.6] for the interface's active alternate setting

B.5.2.6. WDU_ALTERNATE_SETTING Structure

Alternate setting information structure.

FieldTypeDescription
DescriptorWDU_INTERFACE_DESCRIPTOR Interface descriptor information structure [B.5.2.9]
pEndpointDescriptorsWDU_ENDPOINT_DESCRIPTOR* Pointer to the beginning of an array of endpoint descriptor information structures [B.5.2.10] for the alternate setting's endpoints
pPipesWDU_PIPE_INFO* Pointer to the beginning of an array of pipe information structures [B.5.2.11] for the alternate setting's pipes

B.5.2.7. WDU_DEVICE_DESCRIPTOR Structure

USB device descriptor information structure.

FieldTypeDescription
bLengthUCHARSize, in bytes, of the descriptor (18 bytes)
bDescriptorTypeUCHARDevice descriptor (0x01)
bcdUSBUSHORTNumber of the USB specification with which the device complies
bDeviceClassUCHARThe device's class
bDeviceSubClassUCHARThe device's sub-class
bDeviceProtocolUCHARThe device's protocol
bMaxPacketSize0UCHARMaximum size of transferred packets
idVendorUSHORTVendor ID, as assigned by USB-IF
idProductUSHORTProduct ID, as assigned by the product manufacturer
bcdDeviceUSHORTDevice release number
iManufacturerUCHARIndex of manufacturer string descriptor
iProductUCHARIndex of product string descriptor
iSerialNumberUCHARIndex of serial number string descriptor
bNumConfigurationsUCHARNumber of possible configurations

B.5.2.8. WDU_CONFIGURATION_DESCRIPTOR Structure

USB configuration descriptor information structure.

FieldTypeDescription
bLengthUCHARSize, in bytes, of the descriptor
bDescriptorTypeUCHARConfiguration descriptor (0x02)
wTotalLengthUSHORTTotal length, in bytes, of data returned
bNumInterfacesUCHARNumber of interfaces
bConfigurationValueUCHARConfiguration number
iConfigurationUCHARIndex of string descriptor that describes this configuration
bmAttributesUCHAR Power settings for this configuration:
D6 — self-powered
D5 — remote wakeup (allows device to wake up the host)
MaxPowerUCHAR Maximum power consumption for this configuration, in 2mA units

B.5.2.9. WDU_INTERFACE_DESCRIPTOR Structure

USB interface descriptor information structure.

FieldTypeDescription
bLengthUCHARSize, in bytes, of the descriptor (9 bytes)
bDescriptorTypeUCHARInterface descriptor (0x04)
bInterfaceNumberUCHARInterface number
bAlternateSettingUCHARAlternate setting number
bNumEndpointsUCHARNumber of endpoints used by this interface
bInterfaceClassUCHARThe interface's class code, as assigned by USB-IF
bInterfaceSubClassUCHARThe interface's sub-class code, as assigned by USB-IF
bInterfaceProtocolUCHARThe interface's protocol code, as assigned by USB-IF
iInterfaceUCHARIndex of string descriptor that describes this interface

B.5.2.10. WDU_ENDPOINT_DESCRIPTOR Structure

USB endpoint descriptor information structure.

FieldTypeDescription
bLengthUCHARSize, in bytes, of the descriptor (7 bytes)
bDescriptorTypeUCHAREndpoint descriptor (0x05)
bEndpointAddressUCHAR Endpoint address: Use bits 0–3 for endpoint number, set bits 4–6 to zero (0), and set bit 7 to zero (0) for outbound data and to one (1) for inbound data (ignored for control endpoints).
bmAttributesUCHAR Specifies the transfer type for this endpoint (control, interrupt, isochronous or bulk). See the USB specification for further information.
wMaxPacketSizeUSHORTMaximum size of packets this endpoint can send or receive
bIntervalUCHAR Interval, in frame counts, for polling endpoint data transfers.
Ignored for bulk and control endpoints.
Must equal 1 for isochronous endpoints.
May range from 1 to 255 for interrupt endpoints.

B.5.2.11. WDU_PIPE_INFO Structure

USB pipe information structure.

FieldTypeDescription
dwNumberDWORDPipe number; zero for the default control pipe
dwMaximumPacketSizeDWORDMaximum size of packets that can be transferred using this pipe
typeDWORDTransfer type for this pipe
directionDWORD Direction of the transfer:
WDU_DIR_IN or WDU_DIR_OUT for isochronous, bulk or interrupt pipes.
WDU_DIR_IN_OUT for control pipes.
dwIntervalDWORD Interval in milliseconds.
Relevant only to interrupt pipes.