1/*++
2
3Copyright (c) Microsoft Corporation. All rights reserved.
4
5Module Name:
6
7        USBIOCTL.H
8
9Abstract:
10
11   This file defines both kernel and user mode IOCTL
12   codes supported by the USB core stack.
13
14Environment:
15
16    Kernel & user mode
17
18Revision History:
19
20    09-29-95 : created
21    01-06-97 : added user mode hub ioctls
22    10-31-99 : cleanup and document, jdunn
23
24--*/
25
26
27#ifndef   __USBIOCTL_H__
28#define   __USBIOCTL_H__
29
30#include "usb100.h"
31
32#ifndef FAR
33#define FAR
34#endif
35
36#include "usbiodef.h"
37
38//#pragma message ("warning: using obsolete header file usbioctl.h")
39
40/*
41    IOCTLS definitions
42*/
43
44/*
45   USB kernel Mode IOCTLS
46*/
47
48/* IOCTL_INTERNAL_USB_SUBMIT_URB
49
50   This IOCTL is used by client drivers to submit URB (USB Request Blocks)
51
52   Parameters.Others.Argument1 = pointer to URB
53
54*/
55
56#define IOCTL_INTERNAL_USB_SUBMIT_URB  CTL_CODE(FILE_DEVICE_USB,  \
57                                                USB_SUBMIT_URB,  \
58                                                METHOD_NEITHER,  \
59                                                FILE_ANY_ACCESS)
60
61
62/* IOCTL_INTERNAL_USB_RESET_PORT
63
64    This IOCTL is used by kernel mode drivers to reset their
65    upstream port.
66
67    After a successful reset the device is re-configured to the
68    same configuration it was in before the reset.  All pipe
69    handles, configuration handles and interface handles remain
70    valid.
71
72*/
73
74#define IOCTL_INTERNAL_USB_RESET_PORT  CTL_CODE(FILE_DEVICE_USB,  \
75                                                USB_RESET_PORT, \
76                                                METHOD_NEITHER,  \
77                                                FILE_ANY_ACCESS)
78
79
80/*  IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO
81
82    This IOCTL is used internally by the hub driver this API will
83    return the PhysicalDeviceObject of the root hub enumerated by the
84    controller.
85
86    Parameters.Others.Argument1 =
87        pointer to be filled in with PDO for the root hub;
88    Parameters.Others.Argument2 =
89        pointer to be filled in with FDO of the USB Host Controller;
90
91*/
92
93#define IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO  CTL_CODE(FILE_DEVICE_USB,  \
94                                                USB_GET_ROOTHUB_PDO, \
95                                                METHOD_NEITHER,  \
96                                                FILE_ANY_ACCESS)
97
98
99
100/* IOCTL_INTERNAL_USB_GET_PORT_STATUS
101
102    This IOCTL returns the current status of the devices upstream
103    port.
104
105    Parameters.Others.Argument1 =
106        pointer to port status register (ULONG)
107
108    status bits are:
109
110    USBD_PORT_ENABLED
111    USBD_PORT_CONNECTED
112
113*/
114
115#define  USBD_PORT_ENABLED      0x00000001
116#define  USBD_PORT_CONNECTED    0x00000002
117
118
119#define IOCTL_INTERNAL_USB_GET_PORT_STATUS  CTL_CODE(FILE_DEVICE_USB,  \
120                                                USB_GET_PORT_STATUS, \
121                                                METHOD_NEITHER,  \
122                                                FILE_ANY_ACCESS)
123
124/* IOCTL_INTERNAL_USB_ENABLE_PORT
125
126    This IOCTL is obsolete, drivers should use
127    IOCTL_INTERNAL_USB_RESET_PORT
128*/
129
130#define IOCTL_INTERNAL_USB_ENABLE_PORT      CTL_CODE(FILE_DEVICE_USB,  \
131                                                USB_ENABLE_PORT, \
132                                                METHOD_NEITHER,  \
133                                                FILE_ANY_ACCESS)
134
135/* IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION
136
137    This ioctl registers a device to receive notification when a specific
138    timeout has expired and it should now be suspended in order to conserve
139    power. If all devices on a hub are suspended, then the actual hub
140    can be suspended.
141
142*/
143
144#define IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION   CTL_CODE(FILE_DEVICE_USB,  \
145                                                USB_IDLE_NOTIFICATION,  \
146                                                METHOD_NEITHER,  \
147                                                FILE_ANY_ACCESS)
148
149/* IOCTL_INTERNAL_USB_GET_HUB_COUNT
150
151    This IOCTL is used internally by the hub driver, it returns the
152    number of hubs between the device and the root hub.
153
154    Parameters.Others.Argument1 =
155        pointer to be count of hubs in chain;
156
157*/
158#define IOCTL_INTERNAL_USB_GET_HUB_COUNT      CTL_CODE(FILE_DEVICE_USB,  \
159                                                USB_GET_HUB_COUNT, \
160                                                METHOD_NEITHER,  \
161                                                FILE_ANY_ACCESS)
162
163/* IOCTL_INTERNAL_USB_CYCLE_PORT
164
165    This IOCTL will simulate a plug/unplug on the port.
166    The device will be removed and re-added by PnP.
167*/
168
169#define IOCTL_INTERNAL_USB_CYCLE_PORT  CTL_CODE(FILE_DEVICE_USB,  \
170                                                USB_CYCLE_PORT, \
171                                                METHOD_NEITHER,  \
172                                                FILE_ANY_ACCESS)
173
174/* IOCTL_INTERNAL_USB_GET_HUB_NAME
175
176*/
177
178#define IOCTL_INTERNAL_USB_GET_HUB_NAME  CTL_CODE(FILE_DEVICE_USB,  \
179                                                USB_GET_HUB_NAME,  \
180                                                METHOD_BUFFERED,  \
181                                                FILE_ANY_ACCESS)
182
183/* IOCTL_INTERNAL_USB_GET_BUS_INFO
184
185    This IOCTL is obsolete -- it has been replaced by the
186    USB_BUSIFFN_QUERY_BUS_INFORMATION service available thru
187    the usb stack bus interface.
188*/
189
190#define IOCTL_INTERNAL_USB_GET_BUS_INFO         CTL_CODE(FILE_DEVICE_USB,  \
191                                                    USB_GET_BUS_INFO,  \
192                                                    METHOD_BUFFERED,  \
193                                                    FILE_ANY_ACCESS)
194
195/* IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME
196
197*/
198
199#define IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME  CTL_CODE(FILE_DEVICE_USB,  \
200                                                    USB_GET_CONTROLLER_NAME,  \
201                                                    METHOD_BUFFERED,  \
202                                                    FILE_ANY_ACCESS)
203
204/* IOCTL_INTERNAL_USB_GET_BUSGUID_INFO
205
206*/
207
208#define IOCTL_INTERNAL_USB_GET_BUSGUID_INFO     CTL_CODE(FILE_DEVICE_USB,  \
209                                                    USB_GET_BUSGUID_INFO,  \
210                                                    METHOD_BUFFERED,  \
211                                                    FILE_ANY_ACCESS)
212
213/* IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO
214
215*/
216
217#define IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO   CTL_CODE(FILE_DEVICE_USB,  \
218                                                    USB_GET_PARENT_HUB_INFO,  \
219                                                    METHOD_BUFFERED,  \
220                                                    FILE_ANY_ACCESS)
221
222#define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE    CTL_CODE(FILE_DEVICE_USB,  \
223                                                   USB_GET_DEVICE_HANDLE, \
224                                                   METHOD_NEITHER,  \
225                                                   FILE_ANY_ACCESS)
226
227/*
228   USB user mode IOCTLS
229*/
230
231/************************************************************
232The following IOCTLS are always sent to the HCD symbolic
233name
234*************************************************************/
235
236/* IOCTL_USB_HCD_GET_STATS_1 (OPTIONAL)
237
238    The following IOCTL is used to return internal statictics
239    for HCDs
240
241*/
242
243#define IOCTL_USB_HCD_GET_STATS_1          CTL_CODE(FILE_DEVICE_USB,  \
244                                                HCD_GET_STATS_1,  \
245                                                METHOD_BUFFERED,  \
246                                                FILE_ANY_ACCESS)
247
248/* IOCTL_USB_HCD_GET_STATS_2 (OPTIONAL)
249
250    The following IOCTL is used to return internal statictics
251    for HCDs
252
253*/
254
255#define IOCTL_USB_HCD_GET_STATS_2          CTL_CODE(FILE_DEVICE_USB,  \
256                                                HCD_GET_STATS_2,  \
257                                                METHOD_BUFFERED,  \
258                                                FILE_ANY_ACCESS)
259
260#define IOCTL_USB_HCD_DISABLE_PORT          CTL_CODE(FILE_DEVICE_USB, \
261                                                HCD_DISABLE_PORT, \
262                                                METHOD_BUFFERED, \
263                                                FILE_ANY_ACCESS)
264
265#define IOCTL_USB_HCD_ENABLE_PORT           CTL_CODE(FILE_DEVICE_USB, \
266                                                HCD_ENABLE_PORT, \
267                                                METHOD_BUFFERED, \
268                                                FILE_ANY_ACCESS)
269
270
271/*
272   These ioctls are used for USB diagnostic and test applications
273*/
274
275#define IOCTL_USB_DIAGNOSTIC_MODE_ON   CTL_CODE(FILE_DEVICE_USB,  \
276                                                HCD_DIAGNOSTIC_MODE_ON,  \
277                                                METHOD_BUFFERED,  \
278                                                FILE_ANY_ACCESS)
279
280#define IOCTL_USB_DIAGNOSTIC_MODE_OFF  CTL_CODE(FILE_DEVICE_USB,  \
281                                                HCD_DIAGNOSTIC_MODE_OFF,  \
282                                                METHOD_BUFFERED,  \
283                                                FILE_ANY_ACCESS)
284
285#define IOCTL_USB_GET_ROOT_HUB_NAME  CTL_CODE(FILE_DEVICE_USB,  \
286                                                HCD_GET_ROOT_HUB_NAME,  \
287                                                METHOD_BUFFERED,  \
288                                                FILE_ANY_ACCESS)
289
290#define IOCTL_GET_HCD_DRIVERKEY_NAME CTL_CODE(FILE_DEVICE_USB,  \
291                                                HCD_GET_DRIVERKEY_NAME,  \
292                                                METHOD_BUFFERED,  \
293                                                FILE_ANY_ACCESS)
294
295
296/*********************************************************
297The following IOCTLS are always sent to symbolic names
298created by usbhub
299**********************************************************/
300
301/*
302    Utility IOCTLS supported by the hub device
303*/
304
305/*
306   These ioctls are supported by the hub driver for
307   use by user mode USB utilities.
308*/
309
310
311#define IOCTL_USB_GET_NODE_INFORMATION   CTL_CODE(FILE_DEVICE_USB,  \
312                                               USB_GET_NODE_INFORMATION,  \
313                                               METHOD_BUFFERED,  \
314                                               FILE_ANY_ACCESS)
315
316#define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION  CTL_CODE(FILE_DEVICE_USB,  \
317                                                USB_GET_NODE_CONNECTION_INFORMATION,  \
318                                                METHOD_BUFFERED,  \
319                                                FILE_ANY_ACCESS)
320
321#define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES  CTL_CODE(FILE_DEVICE_USB,  \
322                                                USB_GET_NODE_CONNECTION_ATTRIBUTES,\
323                                                METHOD_BUFFERED,  \
324                                                FILE_ANY_ACCESS)
325
326#define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION   CTL_CODE(FILE_DEVICE_USB,  \
327                                                USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,  \
328                                                METHOD_BUFFERED,  \
329                                                FILE_ANY_ACCESS)
330
331#define IOCTL_USB_GET_NODE_CONNECTION_NAME     CTL_CODE(FILE_DEVICE_USB,  \
332                                                USB_GET_NODE_CONNECTION_NAME,  \
333                                                METHOD_BUFFERED,  \
334                                                FILE_ANY_ACCESS)
335
336#define IOCTL_USB_DIAG_IGNORE_HUBS_ON   CTL_CODE(FILE_DEVICE_USB,  \
337                                                USB_DIAG_IGNORE_HUBS_ON,  \
338                                                METHOD_BUFFERED,  \
339                                                FILE_ANY_ACCESS)
340
341#define IOCTL_USB_DIAG_IGNORE_HUBS_OFF  CTL_CODE(FILE_DEVICE_USB,  \
342                                                USB_DIAG_IGNORE_HUBS_OFF,  \
343                                                METHOD_BUFFERED,  \
344                                                FILE_ANY_ACCESS)
345
346#define IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME  CTL_CODE(FILE_DEVICE_USB,  \
347                                                USB_GET_NODE_CONNECTION_DRIVERKEY_NAME,  \
348                                                METHOD_BUFFERED,  \
349                                                FILE_ANY_ACCESS)
350
351#define IOCTL_USB_GET_HUB_CAPABILITIES  CTL_CODE(FILE_DEVICE_USB,  \
352                                               USB_GET_HUB_CAPABILITIES,  \
353                                               METHOD_BUFFERED,  \
354                                               FILE_ANY_ACCESS)
355
356#define IOCTL_USB_HUB_CYCLE_PORT		CTL_CODE(FILE_DEVICE_USB,  \
357                                               USB_HUB_CYCLE_PORT,  \
358                                               METHOD_BUFFERED,  \
359                                               FILE_ANY_ACCESS)
360
361#define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX  CTL_CODE(FILE_DEVICE_USB,  \
362                                                USB_GET_NODE_CONNECTION_INFORMATION_EX,  \
363                                                METHOD_BUFFERED,  \
364                                                FILE_ANY_ACCESS)
365
366
367
368/*
369   structures for user mode ioctls
370*/
371
372#include "pshpack1.h"
373
374typedef enum _USB_HUB_NODE {
375    UsbHub,
376    UsbMIParent
377} USB_HUB_NODE;
378
379typedef struct _USB_HUB_INFORMATION {
380    /*
381       copy of data from hub descriptor
382    */
383    USB_HUB_DESCRIPTOR HubDescriptor;
384
385    BOOLEAN HubIsBusPowered;
386
387} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;
388
389typedef struct _USB_MI_PARENT_INFORMATION {
390    ULONG NumberOfInterfaces;
391} USB_MI_PARENT_INFORMATION, *PUSB_MI_PARENT_INFORMATION;
392
393typedef struct _USB_NODE_INFORMATION {
394    USB_HUB_NODE NodeType;        /* hub, mi parent */
395    union {
396        USB_HUB_INFORMATION HubInformation;
397        USB_MI_PARENT_INFORMATION MiParentInformation;
398    } u;
399} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;
400
401typedef struct _USB_PIPE_INFO {
402    USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
403    ULONG ScheduleOffset;
404} USB_PIPE_INFO, *PUSB_PIPE_INFO;
405
406typedef struct _USB_HUB_CAPABILITIES {
407    /*
408        Unlike the USB_HUB_INFORMATION structure used by
409        IOCTL_USB_GET_NODE_INFORMATION, this structure can be extended in the
410        future to accomodate more data.  The IOCTL will return only as much
411        data as indicated by the size of the request buffer, to maintain
412        backward compatibility with older callers that don't know about the
413        new data.
414    */
415
416    ULONG HubIs2xCapable:1;
417
418} USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES;
419
420
421typedef enum _USB_CONNECTION_STATUS {
422    NoDeviceConnected,
423    DeviceConnected,
424
425    /* failure codes, these map to fail reasons */
426    DeviceFailedEnumeration,
427    DeviceGeneralFailure,
428    DeviceCausedOvercurrent,
429    DeviceNotEnoughPower,
430    DeviceNotEnoughBandwidth,
431    DeviceHubNestedTooDeeply,
432    DeviceInLegacyHub
433} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
434
435typedef struct _USB_NODE_CONNECTION_INFORMATION {
436    ULONG ConnectionIndex;
437    /* usb device descriptor returned by this device
438       during enumeration */
439    USB_DEVICE_DESCRIPTOR DeviceDescriptor;
440    UCHAR CurrentConfigurationValue;
441    BOOLEAN LowSpeed;
442
443    BOOLEAN DeviceIsHub;
444
445    USHORT DeviceAddress;
446
447    ULONG NumberOfOpenPipes;
448
449    USB_CONNECTION_STATUS ConnectionStatus;
450    USB_PIPE_INFO PipeList[0];
451} USB_NODE_CONNECTION_INFORMATION, *PUSB_NODE_CONNECTION_INFORMATION;
452
453/*
454	values for the speed field are defined in USB200.h
455
456*/
457
458typedef struct _USB_NODE_CONNECTION_INFORMATION_EX {
459    ULONG ConnectionIndex;
460    /* usb device descriptor returned by this device
461       during enumeration */
462    USB_DEVICE_DESCRIPTOR DeviceDescriptor;
463    UCHAR CurrentConfigurationValue;
464    UCHAR Speed;
465
466    BOOLEAN DeviceIsHub;
467
468    USHORT DeviceAddress;
469
470    ULONG NumberOfOpenPipes;
471
472    USB_CONNECTION_STATUS ConnectionStatus;
473    USB_PIPE_INFO PipeList[0];
474} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;
475
476typedef struct _USB_NODE_CONNECTION_ATTRIBUTES {
477    ULONG ConnectionIndex;
478    /* usb device descriptor returned by this device
479       during enumeration */
480    USB_CONNECTION_STATUS ConnectionStatus;
481
482    /* extended port attributes defined in usb.h*/
483    ULONG PortAttributes;
484} USB_NODE_CONNECTION_ATTRIBUTES, *PUSB_NODE_CONNECTION_ATTRIBUTES;
485
486typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {
487    ULONG ConnectionIndex;  /* INPUT */
488    ULONG ActualLength;     /* OUTPUT */
489    /* unicode name for the devnode. */
490    WCHAR DriverKeyName[1];      /* OUTPUT */
491} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
492
493typedef struct _USB_NODE_CONNECTION_NAME {
494    ULONG ConnectionIndex;  /* INPUT */
495    ULONG ActualLength;     /* OUTPUT */
496    /* unicode symbolic name for this node if it is a hub or parent driver
497       null if this node is a device. */
498    WCHAR NodeName[1];      /* OUTPUT */
499} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
500
501
502typedef struct _USB_HUB_NAME {
503    ULONG ActualLength;     /* OUTPUT */
504    /* NULL terminated unicode symbolic name for the root hub */
505    WCHAR HubName[1];       /* OUTPUT */
506} USB_HUB_NAME, *PUSB_HUB_NAME;
507
508typedef struct _USB_ROOT_HUB_NAME {
509    ULONG ActualLength;     /* OUTPUT */
510    /* NULL terminated unicode symbolic name for the root hub */
511    WCHAR RootHubName[1];   /* OUTPUT */
512} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;
513
514typedef struct _USB_HCD_DRIVERKEY_NAME {
515    ULONG ActualLength;     /* OUTPUT */
516    /* NULL terminated unicode driverkeyname for hcd */
517    WCHAR DriverKeyName[1];   /* OUTPUT */
518} USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME;
519
520typedef struct _USB_DESCRIPTOR_REQUEST {
521    ULONG ConnectionIndex;
522    struct {
523        UCHAR bmRequest;
524        UCHAR bRequest;
525        USHORT wValue;
526        USHORT wIndex;
527        USHORT wLength;
528    } SetupPacket;
529    UCHAR Data[0];
530} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST;
531
532
533/*
534   Structure for returning HCD debug and statistic information to
535   a user mode application.
536*/
537
538typedef struct _HCD_STAT_COUNTERS {
539    ULONG BytesTransferred;
540
541    USHORT IsoMissedCount;
542    USHORT DataOverrunErrorCount;
543
544    USHORT CrcErrorCount;
545    USHORT ScheduleOverrunCount;
546
547    USHORT TimeoutErrorCount;
548    USHORT InternalHcErrorCount;
549
550    USHORT BufferOverrunErrorCount;
551    USHORT SWErrorCount;
552
553    USHORT StallPidCount;
554    USHORT PortDisableCount;
555
556} HCD_STAT_COUNTERS, *PHCD_STAT_COUNTERS;
557
558
559typedef struct _HCD_ISO_STAT_COUNTERS {
560
561    USHORT  LateUrbs;
562    USHORT  DoubleBufferedPackets;
563
564    USHORT  TransfersCF_5ms;
565    USHORT  TransfersCF_2ms;
566
567    USHORT  TransfersCF_1ms;
568    USHORT  MaxInterruptLatency;
569
570    USHORT  BadStartFrame;
571    USHORT  StaleUrbs;
572
573    /* total count of packets programmed but not accessed by
574       the controller either due to software scheduling
575       problems or HW problems */
576    USHORT  IsoPacketNotAccesed;
577    USHORT  IsoPacketHWError;
578
579    USHORT  SmallestUrbPacketCount;
580    USHORT  LargestUrbPacketCount;
581
582    USHORT IsoCRC_Error;
583    USHORT IsoOVERRUN_Error;
584    USHORT IsoINTERNAL_Error;
585    USHORT IsoUNKNOWN_Error;
586
587    ULONG  IsoBytesTransferred;
588
589    /* count of packets missed due to software scheduling
590       problems */
591    USHORT LateMissedCount;
592    /* incremented when a packet is scheduled but not
593       accessed by the controller */
594    USHORT HWIsoMissedCount;
595
596    ULONG  Reserved7[8];
597
598} HCD_ISO_STAT_COUNTERS, *PHCD_ISO_STAT_COUNTERS;
599
600
601
602typedef struct _HCD_STAT_INFORMATION_1 {
603    ULONG Reserved1;
604    ULONG Reserved2;
605    ULONG ResetCounters;
606    LARGE_INTEGER TimeRead;
607    /*
608       stat registers
609    */
610    HCD_STAT_COUNTERS Counters;
611
612} HCD_STAT_INFORMATION_1, *PHCD_STAT_INFORMATION_1;
613
614typedef struct _HCD_STAT_INFORMATION_2 {
615    ULONG Reserved1;
616    ULONG Reserved2;
617    ULONG ResetCounters;
618    LARGE_INTEGER TimeRead;
619
620    LONG LockedMemoryUsed;
621    /*
622       stat registers
623    */
624    HCD_STAT_COUNTERS Counters;
625    HCD_ISO_STAT_COUNTERS IsoCounters;
626
627} HCD_STAT_INFORMATION_2, *PHCD_STAT_INFORMATION_2;
628
629
630/*
631   WMI related structures
632*/
633
634/* these index in to our array of guids */
635#define WMI_USB_DRIVER_INFORMATION      0
636#define WMI_USB_DRIVER_NOTIFICATION     1
637#define WMI_USB_POWER_DEVICE_ENABLE     2
638
639typedef enum _USB_NOTIFICATION_TYPE {
640
641    /*  the following return a
642        USB_CONNECTION_NOTIFICATION structure: */
643    EnumerationFailure = 0,
644    InsufficentBandwidth,
645    InsufficentPower,
646    OverCurrent,
647    ResetOvercurrent,
648
649    /* the following return a
650       USB_BUS_NOTIFICATION structure:*/
651    AcquireBusInfo,
652
653    /* the following return a
654      USB_ACQUIRE_INFO structure: */
655    AcquireHubName,
656    AcquireControllerName,
657
658    /* the following return a
659       USB_HUB_NOTIFICATION structure: */
660    HubOvercurrent,
661    HubPowerChange,
662
663    HubNestedTooDeeply,
664    ModernDeviceInLegacyHub
665
666} USB_NOTIFICATION_TYPE;
667
668typedef struct _USB_NOTIFICATION {
669    /* indicates type of notification */
670    USB_NOTIFICATION_TYPE NotificationType;
671
672} USB_NOTIFICATION, *PUSB_NOTIFICATION;
673
674/* this structure is used for connection notification
675   codes */
676
677typedef struct _USB_CONNECTION_NOTIFICATION {
678    /* indicates type of notification */
679    USB_NOTIFICATION_TYPE NotificationType;
680
681    /* valid for all connection notifictaion codes,
682       0 indicates global condition for hub or parent
683       this value will be a port number for devices
684       attached to a hub, otherwise a one based
685       index if the device is a child of a composite
686       parent */
687    ULONG ConnectionNumber;
688
689    /* valid for InsufficentBandwidth,
690       the amount of bandwidth the device
691       tried to allocate and was denied. */
692    ULONG RequestedBandwidth;
693
694    /* valid for EnumerationFailure,
695       gives some indication why the device failed
696       to enumerate */
697    ULONG EnumerationFailReason;
698
699    /* valid for InsufficentPower,
700       the amount of power requested to configure
701       this device. */
702    ULONG PowerRequested;
703
704    /* length of the UNICODE symbolic name (in bytes) for the HUB
705       that this device is attached to.
706       not including NULL */
707    ULONG HubNameLength;
708
709} USB_CONNECTION_NOTIFICATION, *PUSB_CONNECTION_NOTIFICATION;
710
711/*
712   This structure is used for the bus notification code 'AcquireBusInfo'
713*/
714
715typedef struct _USB_BUS_NOTIFICATION {
716    /* indicates type of notification */
717    USB_NOTIFICATION_TYPE NotificationType;     /* indicates type of */
718                                                /* notification */
719    ULONG TotalBandwidth;
720    ULONG ConsumedBandwidth;
721
722    /* length of the UNICODE symbolic name (in bytes) for the controller
723       that this device is attached to.
724       not including NULL */
725    ULONG ControllerNameLength;
726
727} USB_BUS_NOTIFICATION, *PUSB_BUS_NOTIFICATION;
728
729/*
730   used to acquire user mode filenames to open respective objects
731*/
732
733typedef struct _USB_ACQUIRE_INFO {
734    /* indicates type of notification */
735    USB_NOTIFICATION_TYPE NotificationType;
736    /* TotalSize of this struct */
737    ULONG TotalSize;
738
739    WCHAR Buffer[1];
740} USB_ACQUIRE_INFO, *PUSB_ACQUIRE_INFO;
741
742
743typedef
744VOID
745(*USB_IDLE_CALLBACK)(
746    PVOID Context
747    );
748
749typedef struct _USB_IDLE_CALLBACK_INFO {
750    USB_IDLE_CALLBACK IdleCallback;
751    PVOID IdleContext;
752} USB_IDLE_CALLBACK_INFO, *PUSB_IDLE_CALLBACK_INFO;
753
754
755#include "poppack.h"
756
757
758#endif /* __USBIOCTL_H__ */
759
760