Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

757 lines
24 KiB

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