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 DEFINE_GUID!{GUID_DEVINTERFACE_USB_HUB,
67 0xf18a0e88, 0xc30c, 0x11d0, 0x88, 0x15, 0x00, 0xa0, 0xc9, 0x06, 0xbe, 0xd8}
68 DEFINE_GUID!{GUID_DEVINTERFACE_USB_DEVICE,
69 0xA5DCBF10, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}
70 DEFINE_GUID!{GUID_DEVINTERFACE_USB_HOST_CONTROLLER,
71 0x3abf6f2d, 0x71c4, 0x462a, 0x8a, 0x92, 0x1e, 0x68, 0x61, 0xe6, 0xaf, 0x27}
72 DEFINE_GUID!{GUID_USB_WMI_STD_DATA,
73 0x4E623B20, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2}
74 DEFINE_GUID!{GUID_USB_WMI_STD_NOTIFICATION,
75 0x4E623B20, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2}
76 DEFINE_GUID!{GUID_USB_WMI_DEVICE_PERF_INFO,
77 0x66c1aa3c, 0x499f, 0x49a0, 0xa9, 0xa5, 0x61, 0xe2, 0x35, 0x9f, 0x64, 0x7}
78 DEFINE_GUID!{GUID_USB_WMI_NODE_INFO,
79 0x9c179357, 0xdc7a, 0x4f41, 0xb6, 0x6b, 0x32, 0x3b, 0x9d, 0xdc, 0xb5, 0xb1}
80 DEFINE_GUID!{GUID_USB_WMI_TRACING,
81 0x3a61881b, 0xb4e6, 0x4bf9, 0xae, 0xf, 0x3c, 0xd8, 0xf3, 0x94, 0xe5, 0x2f}
82 DEFINE_GUID!{GUID_USB_TRANSFER_TRACING,
83 0x681eb8aa, 0x403d, 0x452c, 0x9f, 0x8a, 0xf0, 0x61, 0x6f, 0xac, 0x95, 0x40}
84 DEFINE_GUID!{GUID_USB_PERFORMANCE_TRACING,
85 0xd5de77a6, 0x6ae9, 0x425c, 0xb1, 0xe2, 0xf5, 0x61, 0x5f, 0xd3, 0x48, 0xa9}
86 DEFINE_GUID!{GUID_USB_WMI_SURPRISE_REMOVAL_NOTIFICATION,
87 0x9bbbf831, 0xa2f2, 0x43b4, 0x96, 0xd1, 0x86, 0x94, 0x4b, 0x59, 0x14, 0xb3}
88 pub const GUID_CLASS_USBHUB: GUID = GUID_DEVINTERFACE_USB_HUB;
89 pub const GUID_CLASS_USB_DEVICE: GUID = GUID_DEVINTERFACE_USB_DEVICE;
90 pub const GUID_CLASS_USB_HOST_CONTROLLER: GUID = GUID_DEVINTERFACE_USB_HOST_CONTROLLER;
91 pub const FILE_DEVICE_USB: ULONG = FILE_DEVICE_UNKNOWN;
92 #[inline]
USB_CTL(id: ULONG) -> ULONG93 pub fn USB_CTL(id: ULONG) -> ULONG {
94 CTL_CODE!(FILE_DEVICE_USB, id, METHOD_BUFFERED, FILE_ANY_ACCESS)
95 }
96 #[inline]
USB_KERNEL_CTL(id: ULONG) -> ULONG97 pub fn USB_KERNEL_CTL(id: ULONG) -> ULONG {
98 CTL_CODE!(FILE_DEVICE_USB, id, METHOD_NEITHER, FILE_ANY_ACCESS)
99 }
100 #[inline]
USB_KERNEL_CTL_BUFFERED(id: ULONG) -> ULONG101 pub fn USB_KERNEL_CTL_BUFFERED(id: ULONG) -> ULONG {
102 CTL_CODE!(FILE_DEVICE_USB, id, METHOD_BUFFERED, FILE_ANY_ACCESS)
103 }
104 // No calling convention was specified in the code
105 FN!{stdcall USB_IDLE_CALLBACK(
106 Context: PVOID,
107 ) -> ()}
108 STRUCT!{struct USB_IDLE_CALLBACK_INFO {
109 IdleCallback: USB_IDLE_CALLBACK,
110 IdleContext: PVOID,
111 }}
112 pub type PUSB_IDLE_CALLBACK_INFO = *mut USB_IDLE_CALLBACK_INFO;
113