1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms
6 //! Common header file for all USB IOCTLs defined for
7 //! the core stack. We define them in this single header file
8 //! so that we can maintain backward compatibilty with older
9 //! versions of the stack.
10 use shared::guiddef::GUID;
11 use shared::minwindef::ULONG;
12 use um::winioctl::{FILE_ANY_ACCESS, FILE_DEVICE_UNKNOWN, METHOD_BUFFERED, METHOD_NEITHER};
13 use um::winnt::PVOID;
14 pub const USB_SUBMIT_URB: ULONG = 0;
15 pub const USB_RESET_PORT: ULONG = 1;
16 pub const USB_GET_ROOTHUB_PDO: ULONG = 3;
17 pub const USB_GET_PORT_STATUS: ULONG = 4;
18 pub const USB_ENABLE_PORT: ULONG = 5;
19 pub const USB_GET_HUB_COUNT: ULONG = 6;
20 pub const USB_CYCLE_PORT: ULONG = 7;
21 pub const USB_GET_HUB_NAME: ULONG = 8;
22 pub const USB_IDLE_NOTIFICATION: ULONG = 9;
23 pub const USB_RECORD_FAILURE: ULONG = 10;
24 pub const USB_GET_BUS_INFO: ULONG = 264;
25 pub const USB_GET_CONTROLLER_NAME: ULONG = 265;
26 pub const USB_GET_BUSGUID_INFO: ULONG = 266;
27 pub const USB_GET_PARENT_HUB_INFO: ULONG = 267;
28 pub const USB_GET_DEVICE_HANDLE: ULONG = 268;
29 pub const USB_GET_DEVICE_HANDLE_EX: ULONG = 269;
30 pub const USB_GET_TT_DEVICE_HANDLE: ULONG = 270;
31 pub const USB_GET_TOPOLOGY_ADDRESS: ULONG = 271;
32 pub const USB_IDLE_NOTIFICATION_EX: ULONG = 272;
33 pub const USB_REQ_GLOBAL_SUSPEND: ULONG = 273;
34 pub const USB_REQ_GLOBAL_RESUME: ULONG = 274;
35 pub const USB_GET_HUB_CONFIG_INFO: ULONG = 275;
36 pub const USB_FAIL_GET_STATUS: ULONG = 280;
37 pub const USB_REGISTER_COMPOSITE_DEVICE: ULONG = 0;
38 pub const USB_UNREGISTER_COMPOSITE_DEVICE: ULONG = 1;
39 pub const USB_REQUEST_REMOTE_WAKE_NOTIFICATION: ULONG = 2;
40 pub const HCD_GET_STATS_1: ULONG = 255;
41 pub const HCD_DIAGNOSTIC_MODE_ON: ULONG = 256;
42 pub const HCD_DIAGNOSTIC_MODE_OFF: ULONG = 257;
43 pub const HCD_GET_ROOT_HUB_NAME: ULONG = 258;
44 pub const HCD_GET_DRIVERKEY_NAME: ULONG = 265;
45 pub const HCD_GET_STATS_2: ULONG = 266;
46 pub const HCD_DISABLE_PORT: ULONG = 268;
47 pub const HCD_ENABLE_PORT: ULONG = 269;
48 pub const HCD_USER_REQUEST: ULONG = 270;
49 pub const HCD_TRACE_READ_REQUEST: ULONG = 275;
50 pub const USB_GET_NODE_INFORMATION: ULONG = 258;
51 pub const USB_GET_NODE_CONNECTION_INFORMATION: ULONG = 259;
52 pub const USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION: ULONG = 260;
53 pub const USB_GET_NODE_CONNECTION_NAME: ULONG = 261;
54 pub const USB_DIAG_IGNORE_HUBS_ON: ULONG = 262;
55 pub const USB_DIAG_IGNORE_HUBS_OFF: ULONG = 263;
56 pub const USB_GET_NODE_CONNECTION_DRIVERKEY_NAME: ULONG = 264;
57 pub const USB_GET_HUB_CAPABILITIES: ULONG = 271;
58 pub const USB_GET_NODE_CONNECTION_ATTRIBUTES: ULONG = 272;
59 pub const USB_HUB_CYCLE_PORT: ULONG = 273;
60 pub const USB_GET_NODE_CONNECTION_INFORMATION_EX: ULONG = 274;
61 pub const USB_RESET_HUB: ULONG = 275;
62 pub const USB_GET_HUB_CAPABILITIES_EX: ULONG = 276;
63 pub const USB_GET_HUB_INFORMATION_EX: ULONG = 277;
64 pub const USB_GET_PORT_CONNECTOR_PROPERTIES: ULONG = 278;
65 pub const USB_GET_NODE_CONNECTION_INFORMATION_EX_V2: ULONG = 279;
66 pub const USB_GET_TRANSPORT_CHARACTERISTICS: ULONG = 281;
67 pub const USB_REGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE: ULONG = 282;
68 pub const USB_NOTIFY_ON_TRANSPORT_CHARACTERISTICS_CHANGE: ULONG = 283;
69 pub const USB_UNREGISTER_FOR_TRANSPORT_CHARACTERISTICS_CHANGE: ULONG = 284;
70 pub const USB_START_TRACKING_FOR_TIME_SYNC: ULONG = 285;
71 pub const USB_GET_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC: ULONG = 286;
72 pub const USB_STOP_TRACKING_FOR_TIME_SYNC: ULONG = 287;
73 pub const USB_GET_DEVICE_CHARACTERISTICS: ULONG = 288;
74 DEFINE_GUID!{GUID_DEVINTERFACE_USB_HUB,
75 0xf18a0e88, 0xc30c, 0x11d0, 0x88, 0x15, 0x00, 0xa0, 0xc9, 0x06, 0xbe, 0xd8}
76 DEFINE_GUID!{GUID_DEVINTERFACE_USB_DEVICE,
77 0xA5DCBF10, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}
78 DEFINE_GUID!{GUID_DEVINTERFACE_USB_HOST_CONTROLLER,
79 0x3abf6f2d, 0x71c4, 0x462a, 0x8a, 0x92, 0x1e, 0x68, 0x61, 0xe6, 0xaf, 0x27}
80 DEFINE_GUID!{GUID_USB_WMI_STD_DATA,
81 0x4E623B20, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2}
82 DEFINE_GUID!{GUID_USB_WMI_STD_NOTIFICATION,
83 0x4E623B20, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2}
84 DEFINE_GUID!{GUID_USB_WMI_DEVICE_PERF_INFO,
85 0x66c1aa3c, 0x499f, 0x49a0, 0xa9, 0xa5, 0x61, 0xe2, 0x35, 0x9f, 0x64, 0x7}
86 DEFINE_GUID!{GUID_USB_WMI_NODE_INFO,
87 0x9c179357, 0xdc7a, 0x4f41, 0xb6, 0x6b, 0x32, 0x3b, 0x9d, 0xdc, 0xb5, 0xb1}
88 DEFINE_GUID!{GUID_USB_WMI_TRACING,
89 0x3a61881b, 0xb4e6, 0x4bf9, 0xae, 0xf, 0x3c, 0xd8, 0xf3, 0x94, 0xe5, 0x2f}
90 DEFINE_GUID!{GUID_USB_TRANSFER_TRACING,
91 0x681eb8aa, 0x403d, 0x452c, 0x9f, 0x8a, 0xf0, 0x61, 0x6f, 0xac, 0x95, 0x40}
92 DEFINE_GUID!{GUID_USB_PERFORMANCE_TRACING,
93 0xd5de77a6, 0x6ae9, 0x425c, 0xb1, 0xe2, 0xf5, 0x61, 0x5f, 0xd3, 0x48, 0xa9}
94 DEFINE_GUID!{GUID_USB_WMI_SURPRISE_REMOVAL_NOTIFICATION,
95 0x9bbbf831, 0xa2f2, 0x43b4, 0x96, 0xd1, 0x86, 0x94, 0x4b, 0x59, 0x14, 0xb3}
96 pub const GUID_CLASS_USBHUB: GUID = GUID_DEVINTERFACE_USB_HUB;
97 pub const GUID_CLASS_USB_DEVICE: GUID = GUID_DEVINTERFACE_USB_DEVICE;
98 pub const GUID_CLASS_USB_HOST_CONTROLLER: GUID = GUID_DEVINTERFACE_USB_HOST_CONTROLLER;
99 pub const FILE_DEVICE_USB: ULONG = FILE_DEVICE_UNKNOWN;
100 #[inline]
USB_CTL(id: ULONG) -> ULONG101 pub fn USB_CTL(id: ULONG) -> ULONG {
102 CTL_CODE!(FILE_DEVICE_USB, id, METHOD_BUFFERED, FILE_ANY_ACCESS)
103 }
104 #[inline]
USB_KERNEL_CTL(id: ULONG) -> ULONG105 pub fn USB_KERNEL_CTL(id: ULONG) -> ULONG {
106 CTL_CODE!(FILE_DEVICE_USB, id, METHOD_NEITHER, FILE_ANY_ACCESS)
107 }
108 #[inline]
USB_KERNEL_CTL_BUFFERED(id: ULONG) -> ULONG109 pub fn USB_KERNEL_CTL_BUFFERED(id: ULONG) -> ULONG {
110 CTL_CODE!(FILE_DEVICE_USB, id, METHOD_BUFFERED, FILE_ANY_ACCESS)
111 }
112 // No calling convention was specified in the code
113 FN!{stdcall USB_IDLE_CALLBACK(
114 Context: PVOID,
115 ) -> ()}
116 STRUCT!{struct USB_IDLE_CALLBACK_INFO {
117 IdleCallback: USB_IDLE_CALLBACK,
118 IdleContext: PVOID,
119 }}
120 pub type PUSB_IDLE_CALLBACK_INFO = *mut USB_IDLE_CALLBACK_INFO;
121