Jungo WinDriver  
Official Documentation
windrvr_usb.h
Go to the documentation of this file.
1/* @JUNGO_COPYRIGHT@ */
2
3/* @JUNGO_COPYRIGHT_GPL@ */
4
5/* @JUNGO_COPYRIGHT_GPL_OTHER_OS@ */
6
7#if !defined(_WINDRVR_USB_H_)
8#define _WINDRVR_USB_H_
9
10/* Use it to pad struct size to 64 bit, when using 32 on 64 bit application */
11#ifndef PAD_TO_64
12#if defined (i386) && defined(x86_64)
13#define PAD_TO_64(pName) DWORD dwPad_##pName;
14#else
15#define PAD_TO_64(pName)
16#endif
17#endif
18
19#if defined (i386) && defined(x86_64)
20#define PAD_TO_64_PTR_ARR(pName,size) PVOID ptPad_##pName[size];
21#else
22#define PAD_TO_64_PTR_ARR(pName, size)
23#endif
24
25#if defined(LINUX)
26 #if !defined(__P_TYPES__)
27 #define __P_TYPES__
28 #include <wd_types.h>
29 typedef void VOID;
30 typedef unsigned char UCHAR;
31 typedef unsigned short USHORT;
32 typedef unsigned int UINT;
33 typedef unsigned long ULONG;
34 typedef u32 BOOL;
35 typedef void *PVOID;
36 typedef unsigned char *PBYTE;
37 typedef char CHAR;
38 typedef char *PCHAR;
39 typedef unsigned short *PWORD;
40 typedef u32 DWORD, *PDWORD;
41 typedef int PRCHANDLE;
42 typedef PVOID HANDLE;
43 typedef long LONG;
44 #endif
45 #if !defined(TRUE)
46 #define TRUE 1
47 #endif
48 #if !defined(FALSE)
49 #define FALSE 0
50 #endif
51#endif
52
53typedef enum {
59
60#define WD_USB_MAX_PIPE_NUMBER 32
61#define WD_USB_MAX_ENDPOINTS WD_USB_MAX_PIPE_NUMBER
62#define WD_USB_MAX_INTERFACES 30
63#define WD_USB_MAX_ALT_SETTINGS 255
64
65typedef enum {
70
71/* USB TRANSFER options */
72enum {
75 /* Windows only, ignored on other OS: */
78 USB_BULK_INT_URB_SIZE_OVERRIDE_128K = 0x100, /* Force a 128KB maximum
79 URB size */
80 /* All OS */
82
83 /* The following flags are no longer used beginning with v6.0: */
87 USB_ISOCH_ASAP = 0x8
88};
89
91
92/* Descriptor types */
93#define WDU_DEVICE_DESC_TYPE 0x01
94#define WDU_CONFIG_DESC_TYPE 0x02
95#define WDU_STRING_DESC_STRING 0x03
96#define WDU_INTERFACE_DESC_TYPE 0x04
97#define WDU_ENDPOINT_DESC_TYPE 0x05
98
99/* Endpoint descriptor fields */
100#define WDU_ENDPOINT_TYPE_MASK 0x03
101#define WDU_ENDPOINT_DIRECTION_MASK 0x80
102#define WDU_ENDPOINT_ADDRESS_MASK 0x0f
103/* test direction bit in the bEndpointAddress field of an endpoint
104 * descriptor. */
105#define WDU_ENDPOINT_DIRECTION_OUT(addr) \
106 (!((addr) & WDU_ENDPOINT_DIRECTION_MASK))
107#define WDU_ENDPOINT_DIRECTION_IN(addr) \
108 ((addr) & WDU_ENDPOINT_DIRECTION_MASK)
109#define WDU_GET_MAX_PACKET_SIZE(x) \
110 ((USHORT) (((x) & 0x7ff) * (1 + (((x) & 0x1800) >> 11))))
111
112#ifndef LINUX
113typedef enum {
118#endif
119
120typedef struct
121{
122 DWORD dwNumber;
125 DWORD type;
126 DWORD direction;
133
134typedef struct
135{
136 UCHAR bLength;
150
151typedef struct
152{
153 UCHAR bLength;
165 UCHAR bInterval;
170
171typedef struct
172{
173 UCHAR bLength;
184 UCHAR MaxPower;
187
188typedef struct
189{
190 UCHAR bLength;
192 USHORT bcdUSB;
199 USHORT idVendor;
200 USHORT idProduct;
202 USHORT bcdDevice;
204 UCHAR iProduct;
208
209typedef struct
210{
213 PAD_TO_64(Descriptor)
214 WDU_ENDPOINT_DESCRIPTOR *pEndpointDescriptors;
220 PAD_TO_64(pEndpointDescriptors)
224 PAD_TO_64(pPipes)
226
227typedef struct
228{
234 PAD_TO_64(pAlternateSettings)
235 DWORD dwNumAltSettings;
238 PAD_TO_64(dwNumAltSettings)
239 WDU_ALTERNATE_SETTING *pActiveAltSetting;
243 PAD_TO_64(pActiveAltSetting)
245
246typedef struct
247{
255 PAD_TO_64(pInterfaces)
257
258typedef struct {
266 PAD_TO_64(pConfigs)
267 WDU_CONFIGURATION *pActiveConfig;
271 PAD_TO_64(pActiveConfig)
287} WDU_DEVICE;
288
289/* Note: Any devices found matching this table will be controlled */
290typedef struct
291{
292 USHORT wVendorId;
294 USHORT wProductId;
307
308typedef struct
309{
311 PAD_TO_64(dwUniqueID)
312 PVOID pBuf;
313 PAD_TO_64(pBuf)
314 DWORD dwBytes;
315 DWORD dwOptions;
317
318/* these enum values can be used as dwProperty values, see structure
319 * WD_GET_DEVICE_PROPERTY below. */
320typedef enum
321{
365
366typedef struct
367{
373
374typedef struct
375{
379 PAD_TO_64(dwOptions)
381
382typedef enum {
386
387typedef enum {
391
392typedef struct
393{
397 PAD_TO_64(dwOptions)
399
400typedef struct
401{
404} WDU_WAKEUP;
405
406typedef struct
407{
411
412typedef struct
413{
417
418typedef struct
419{
421 DWORD dwPipeNum;
422 DWORD fRead;
424 DWORD dwOptions;
432 PVOID pBuffer;
433 PAD_TO_64(pBuffer)
434 DWORD dwBufferSize;
435 DWORD dwBytesTransferred;
437 UCHAR SetupPacket[8];
438 DWORD dwTimeout;
440 PAD_TO_64(dwTimeout)
442
443typedef struct
444{
446 UCHAR bType;
447 UCHAR bIndex;
448 USHORT wLength;
449 PVOID pBuffer;
450 PAD_TO_64(pBuffer)
451 USHORT wLanguage;
453
454typedef struct
455{
460 DWORD dwRxSize;
464} WDU_STREAM;
465
466typedef struct
467{
475
476#endif /* _WINDRVR_USB_H_ */
477
WDU_INTERFACE_DESCRIPTOR Descriptor
Interface descriptor information structure.
Definition: windrvr_usb.h:211
UCHAR bDescriptorType
Configuration descriptor (0x02)
Definition: windrvr_usb.h:174
USHORT wTotalLength
Total length, in bytes, of data returned.
Definition: windrvr_usb.h:175
UCHAR bConfigurationValue
Configuration number.
Definition: windrvr_usb.h:177
UCHAR bLength
Size, in bytes, of the descriptor.
Definition: windrvr_usb.h:173
UCHAR bNumInterfaces
Number of interfaces.
Definition: windrvr_usb.h:176
UCHAR bmAttributes
Power settings for this configuration:
Definition: windrvr_usb.h:180
UCHAR iConfiguration
Index of string descriptor that describes this configuration.
Definition: windrvr_usb.h:178
WDU_INTERFACE * pInterfaces
Pointer to the beginning of an array of interface information structures for the configuration's inte...
Definition: windrvr_usb.h:252
DWORD dwNumInterfaces
Number of interfaces supported by this configuration.
Definition: windrvr_usb.h:250
WDU_CONFIGURATION_DESCRIPTOR Descriptor
Configuration descriptor information structure.
Definition: windrvr_usb.h:248
UCHAR bDescriptorType
Device descriptor (0x01)
Definition: windrvr_usb.h:191
UCHAR iManufacturer
Index of manufacturer string descriptor.
Definition: windrvr_usb.h:203
UCHAR bMaxPacketSize0
Maximum size of transferred packets.
Definition: windrvr_usb.h:197
UCHAR bNumConfigurations
Number of possible configurations.
Definition: windrvr_usb.h:206
USHORT idVendor
Vendor ID, as assigned by USB-IF.
Definition: windrvr_usb.h:199
UCHAR bDeviceSubClass
The device's sub-class.
Definition: windrvr_usb.h:195
UCHAR bLength
Size, in bytes, of the descriptor (18 bytes)
Definition: windrvr_usb.h:190
UCHAR iProduct
Index of product string descriptor.
Definition: windrvr_usb.h:204
USHORT idProduct
Product ID, as assigned by the product manufacturer.
Definition: windrvr_usb.h:200
UCHAR bDeviceClass
The device's class.
Definition: windrvr_usb.h:194
USHORT bcdDevice
Device release numbe.
Definition: windrvr_usb.h:202
UCHAR iSerialNumber
Index of serial number string descriptor.
Definition: windrvr_usb.h:205
UCHAR bDeviceProtocol
The device's protocol.
Definition: windrvr_usb.h:196
USHORT bcdUSB
Number of the USB specification with which the device complies.
Definition: windrvr_usb.h:192
WDU_CONFIGURATION * pConfigs
Pointer to the beginning of an array of configuration information structures describing the device's ...
Definition: windrvr_usb.h:263
WDU_DEVICE_DESCRIPTOR Descriptor
CDevice descriptor information structure.
Definition: windrvr_usb.h:259
WDU_PIPE_INFO Pipe0
Pipe information structure for the device's default control pipe (pipe 0)
Definition: windrvr_usb.h:261
UCHAR bInterval
Interval, in frame counts, for polling endpoint data transfers.
Definition: windrvr_usb.h:165
UCHAR bDescriptorType
Endpoint descriptor (0x05)
Definition: windrvr_usb.h:154
UCHAR bmAttributes
Specifies the transfer type for this endpoint (control, interrupt, isochronous or bulk).
Definition: windrvr_usb.h:160
USHORT wMaxPacketSize
Maximum size of packets this endpoint can send or receive.
Definition: windrvr_usb.h:163
UCHAR bLength
Size, in bytes, of the descriptor (7 bytes)
Definition: windrvr_usb.h:153
UCHAR bEndpointAddress
Endpoint address: Use bits 0–3 for endpoint number, set bits 4–6 to zero (0), and set bit 7 to zero (...
Definition: windrvr_usb.h:155
UCHAR bLength
Size, in bytes, of the descriptor (9 bytes)
Definition: windrvr_usb.h:136
UCHAR bInterfaceProtocol
The interface's protocol code, as assigned by USB-IF.
Definition: windrvr_usb.h:145
UCHAR bAlternateSetting
Alternate setting number.
Definition: windrvr_usb.h:139
UCHAR bInterfaceSubClass
The interface's sub-class code, as assigned by USB-IF.
Definition: windrvr_usb.h:143
UCHAR bInterfaceNumber
Interface number.
Definition: windrvr_usb.h:138
UCHAR bDescriptorType
Interface descriptor (0x04)
Definition: windrvr_usb.h:137
UCHAR bInterfaceClass
The interface's class code, as assigned by USB-IF.
Definition: windrvr_usb.h:141
UCHAR bNumEndpoints
Number of endpoints used by this interface.
Definition: windrvr_usb.h:140
UCHAR iInterface
Index of string descriptor that describes this interface.
Definition: windrvr_usb.h:147
WDU_ALTERNATE_SETTING * pAlternateSettings
Pointer to the beginning of an array of alternate setting information structures for the interface's ...
Definition: windrvr_usb.h:229
UCHAR bInterfaceProtocol
The interface's protocol code, as assigned by USB-IF (*)
Definition: windrvr_usb.h:304
UCHAR bInterfaceClass
The interface's class code, as assigned by USB-IF (*)
Definition: windrvr_usb.h:300
USHORT wProductId
Required USB Product ID to detect, as assigned by the product manufacturer (*)
Definition: windrvr_usb.h:294
UCHAR bDeviceSubClass
The device's sub-class code, as assigned by USB-IF (*)
Definition: windrvr_usb.h:298
USHORT wVendorId
Required USB Vendor ID to detect, as assigned by USB-IF (*)
Definition: windrvr_usb.h:292
UCHAR bInterfaceSubClass
The interface's sub-class code, as assigned by USB-IF (*)
Definition: windrvr_usb.h:302
UCHAR bDeviceClass
The device's class code, as assigned by USB-IF (*)
Definition: windrvr_usb.h:296
DWORD dwMaximumPacketSize
Maximum size of packets that can be transferred using this pipe.
Definition: windrvr_usb.h:123
DWORD type
Transfer type for this pipe.
Definition: windrvr_usb.h:125
DWORD dwInterval
Interval in milliseconds.
Definition: windrvr_usb.h:130
DWORD direction
Direction of the transfer:
Definition: windrvr_usb.h:126
DWORD dwNumber
Pipe number; zero for the default control pipe.
Definition: windrvr_usb.h:122
DWORD dwAlternateSetting
Definition: windrvr_usb.h:370
DWORD dwReserved
Definition: windrvr_usb.h:463
DWORD dwRxSize
Definition: windrvr_usb.h:460
DWORD dwBufferSize
Definition: windrvr_usb.h:459
DWORD dwPipeNum
Definition: windrvr_usb.h:458
DWORD dwOptions
Definition: windrvr_usb.h:457
DWORD dwRxTxTimeout
Definition: windrvr_usb.h:462
BOOL fBlocking
Definition: windrvr_usb.h:461
DWORD dwUniqueID
Definition: windrvr_usb.h:456
DWORD dwUniqueID
Definition: windrvr_usb.h:420
DWORD dwOptions
USB_TRANSFER options: USB_ISOCH_FULL_PACKETS_ONLY - For isochronous transfers only.
Definition: windrvr_usb.h:424
PVOID pBuffer
Pointer to buffer to read/write.
Definition: windrvr_usb.h:432
DWORD fRead
TRUE for read (IN) transfers; FALSE for write (OUT) transfers.
Definition: windrvr_usb.h:422
DWORD dwPipeNum
Pipe number on device.
Definition: windrvr_usb.h:421
DWORD dwOptions
Definition: windrvr_usb.h:403
DWORD dwUniqueID
Definition: windrvr_usb.h:402
unsigned int u32
Definition: wd_types.h:10
USB_DIR
Definition: windrvr_usb.h:113
@ USB_DIR_OUT
Definition: windrvr_usb.h:115
@ USB_DIR_IN
Definition: windrvr_usb.h:114
@ USB_DIR_IN_OUT
Definition: windrvr_usb.h:116
USB_PIPE_TYPE
Definition: windrvr_usb.h:53
@ PIPE_TYPE_INTERRUPT
Definition: windrvr_usb.h:57
@ PIPE_TYPE_ISOCHRONOUS
Definition: windrvr_usb.h:55
@ PIPE_TYPE_CONTROL
Definition: windrvr_usb.h:54
@ PIPE_TYPE_BULK
Definition: windrvr_usb.h:56
WD_DEVICE_REGISTRY_PROPERTY
Definition: windrvr_usb.h:321
@ WdDevicePropertyInstallState
The device's installation state.
Definition: windrvr_usb.h:361
@ WdDevicePropertyHardwareID
The device's hardware IDs.
Definition: windrvr_usb.h:323
@ WdDevicePropertyEnumeratorName
The name of the device's enumerator (e.g., "PCI" or "root")
Definition: windrvr_usb.h:354
@ WdDevicePropertyCompatibleIDs
The device's compatible IDs.
Definition: windrvr_usb.h:324
@ WdDevicePropertyLegacyBusType
The bus type (e.g., PCIBus)
Definition: windrvr_usb.h:351
@ WdDevicePropertyFriendlyName
Friendly device name (typically defined by the class installer), which can be used to distinguish bet...
Definition: windrvr_usb.h:339
@ WdDevicePropertyClassName
The name of the device's setup class, in text format.
Definition: windrvr_usb.h:332
@ WdDevicePropertyBootConfigurationTranslated
The hardware resources assigned to the device by the firmware, in translated form.
Definition: windrvr_usb.h:328
@ WdDevicePropertyBusNumber
The legacy bus number of the bus to which the device is connected.
Definition: windrvr_usb.h:352
@ WdDevicePropertyManufacturer
Device manufacturer string.
Definition: windrvr_usb.h:338
@ WdDevicePropertyUINumber
A number associated with the device that can be displayed in the user interface.
Definition: windrvr_usb.h:359
@ WdDevicePropertyBootConfiguration
The hardware resources assigned to the device by the firmware, in raw data form.
Definition: windrvr_usb.h:325
@ WdDevicePropertyClassGuid
The GUID for the device's setup class (string format)
Definition: windrvr_usb.h:334
@ WdDevicePropertyLocationInformation
Information about the device's Location on the bus (string format).
Definition: windrvr_usb.h:342
@ WdDevicePropertyDeviceDescription
Device description.
Definition: windrvr_usb.h:322
@ WdDevicePropertyAddress
The device's bus address.
Definition: windrvr_usb.h:356
@ WdDevicePropertyRemovalPolicy
The device's current removal policy (Windows)
Definition: windrvr_usb.h:362
@ WdDevicePropertyBusTypeGuid
The GUID for the bus to which the device is connected.
Definition: windrvr_usb.h:349
@ WdDevicePropertyPhysicalDeviceObjectName
The name of the Physical Device Object (PDO) for the device.
Definition: windrvr_usb.h:346
@ WdDevicePropertyDriverKeyName
The name of the driver-specific registry key.
Definition: windrvr_usb.h:336
WDU_SELECTIVE_SUSPEND_OPTIONS
Definition: windrvr_usb.h:387
@ WDU_SELECTIVE_SUSPEND_SUBMIT
Definition: windrvr_usb.h:388
@ WDU_SELECTIVE_SUSPEND_CANCEL
Definition: windrvr_usb.h:389
#define PAD_TO_64(pName)
Definition: windrvr_usb.h:15
@ USB_ISOCH_RESET
Definition: windrvr_usb.h:73
@ USB_STREAM_OVERWRITE_BUFFER_WHEN_FULL
Definition: windrvr_usb.h:81
@ USB_SHORT_TRANSFER
Definition: windrvr_usb.h:85
@ USB_ISOCH_ASAP
Definition: windrvr_usb.h:87
@ USB_TRANSFER_HALT
Definition: windrvr_usb.h:84
@ USB_ISOCH_FULL_PACKETS_ONLY
Definition: windrvr_usb.h:74
@ USB_FULL_TRANSFER
Definition: windrvr_usb.h:86
@ USB_ABORT_PIPE
Definition: windrvr_usb.h:76
@ USB_ISOCH_NOASAP
Definition: windrvr_usb.h:77
@ USB_BULK_INT_URB_SIZE_OVERRIDE_128K
Definition: windrvr_usb.h:78
WDU_WAKEUP_OPTIONS
Definition: windrvr_usb.h:382
@ WDU_WAKEUP_ENABLE
Definition: windrvr_usb.h:383
@ WDU_WAKEUP_DISABLE
Definition: windrvr_usb.h:384
PVOID WDU_REGISTER_DEVICES_HANDLE
Definition: windrvr_usb.h:90
#define PAD_TO_64_PTR_ARR(pName, size)
Definition: windrvr_usb.h:22
WDU_DIR
Definition: windrvr_usb.h:65
@ WDU_DIR_IN_OUT
Definition: windrvr_usb.h:68
@ WDU_DIR_OUT
Definition: windrvr_usb.h:67
@ WDU_DIR_IN
Definition: windrvr_usb.h:66
#define WD_USB_MAX_INTERFACES
Definition: windrvr_usb.h:62