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