/usr/src/ndiswrapper-1.59/usb.h is in ndiswrapper-dkms 1.59-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | /*
* Copyright (C) 2004 Jan Kiszka
* Copyright (C) 2005 Giridhar Pemmasani
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _USB_H_
#define _USB_H_
#include "ntoskernel.h"
#define IOCTL_INTERNAL_USB_SUBMIT_URB 0x00220003
#define IOCTL_INTERNAL_USB_RESET_PORT 0x00220007
#define IOCTL_INTERNAL_USB_GET_PORT_STATUS 0x00220013
#define IOCTL_INTERNAL_USB_CYCLE_PORT 0x0022001F
#define IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION 0x00220027
#define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
#define URB_FUNCTION_SELECT_INTERFACE 0x0001
#define URB_FUNCTION_ABORT_PIPE 0x0002
#define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003
#define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004
#define URB_FUNCTION_GET_FRAME_LENGTH 0x0005
#define URB_FUNCTION_SET_FRAME_LENGTH 0x0006
#define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007
#define URB_FUNCTION_CONTROL_TRANSFER 0x0008
#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
#define URB_FUNCTION_ISOCH_TRANSFER 0x000A
#define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
#define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C
#define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D
#define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E
#define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F
#define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010
#define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011
#define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012
#define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013
#define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014
#define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015
#define URB_FUNCTION_RESERVED_0X0016 0x0016
#define URB_FUNCTION_VENDOR_DEVICE 0x0017
#define URB_FUNCTION_VENDOR_INTERFACE 0x0018
#define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
#define URB_FUNCTION_CLASS_DEVICE 0x001A
#define URB_FUNCTION_CLASS_INTERFACE 0x001B
#define URB_FUNCTION_CLASS_ENDPOINT 0x001C
#define URB_FUNCTION_RESERVE_0X001D 0x001D
#define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 0x001E
#define URB_FUNCTION_CLASS_OTHER 0x001F
#define URB_FUNCTION_VENDOR_OTHER 0x0020
#define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021
#define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022
#define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023
#define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024
#define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025
#define URB_FUNCTION_GET_CONFIGURATION 0x0026
#define URB_FUNCTION_GET_INTERFACE 0x0027
#define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028
#define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029
#define URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR 0x002A
#define URB_FUNCTION_RESERVE_0X002B 0x002B
#define URB_FUNCTION_RESERVE_0X002C 0x002C
#define URB_FUNCTION_RESERVE_0X002D 0x002D
#define URB_FUNCTION_RESERVE_0X002E 0x002E
#define URB_FUNCTION_RESERVE_0X002F 0x002F
// USB 2.0 calls start at 0x0030
#define URB_FUNCTION_SYNC_RESET_PIPE 0x0030
#define URB_FUNCTION_SYNC_CLEAR_STALL 0x0031
#define URB_FUNCTION_CONTROL_TRANSFER_EX 0x0032
#define USBD_PF_CHANGE_MAX_PACKET 0x00000001
#define USBD_TRANSFER_DIRECTION_OUT 0
#define USBD_TRANSFER_DIRECTION_IN 1
#define USBD_SHORT_TRANSFER_OK 0x00000002
#define USBD_START_ISO_TRANSFER_ASAP 0x00000004
#define USBD_DEFAULT_PIPE_TRANSFER 0x00000008
#define USBD_TRANSFER_DIRECTION(flags) \
((flags) & USBD_TRANSFER_DIRECTION_IN)
enum pipe_type {UsbdPipeTypeControl = USB_ENDPOINT_XFER_CONTROL,
UsbdPipeTypeIsochronous = USB_ENDPOINT_XFER_ISOC,
UsbdPipeTypeBulk = USB_ENDPOINT_XFER_BULK,
UsbdPipeTypeInterrupt = USB_ENDPOINT_XFER_INT};
#define USBD_IS_BULK_PIPE(pipe_handle) \
(((pipe_handle)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) \
== USB_ENDPOINT_XFER_BULK)
#define USBD_IS_INT_PIPE(pipe_handle) \
(((pipe_handle)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) \
== USB_ENDPOINT_XFER_INT)
#define USBD_PORT_ENABLED 0x00000001
#define USBD_PORT_CONNECTED 0x00000002
typedef LONG USBD_STATUS;
#define USBD_STATUS_SUCCESS 0x0
#define USBD_STATUS_PENDING 0x40000000
#define USBD_STATUS_CANCELED 0x00010000
#define USBD_STATUS_CRC 0xC0000001
#define USBD_STATUS_BTSTUFF 0xC0000002
#define USBD_STATUS_DATA_TOGGLE_MISMATCH 0xC0000003
#define USBD_STATUS_STALL_PID 0xC0000004
#define USBD_STATUS_DEV_NOT_RESPONDING 0xC0000005
#define USBD_STATUS_PID_CHECK_FAILURE 0xC0000006
#define USBD_STATUS_UNEXPECTED_PID 0xC0000007
#define USBD_STATUS_DATA_OVERRUN 0xC0000008
#define USBD_STATUS_DATA_UNDERRUN 0xC0000009
#define USBD_STATUS_RESERVED1 0xC000000A
#define USBD_STATUS_RESERVED2 0xC000000B
#define USBD_STATUS_BUFFER_OVERRUN 0xC000000C
#define USBD_STATUS_BUFFER_UNDERRUN 0xC000000D
#define USBD_STATUS_NOT_ACCESSED 0xC000000F
#define USBD_STATUS_FIFO 0xC0000010
#define USBD_STATUS_XACT_ERROR 0xC0000011
#define USBD_STATUS_BABBLE_DETECTED 0xC0000012
#define USBD_STATUS_DATA_BUFFER_ERROR 0xC0000013
#define USBD_STATUS_NOT_SUPPORTED 0xC0000E00
#define USBD_STATUS_BUFFER_TOO_SMALL 0xC0003000
#define USBD_STATUS_TIMEOUT 0xC0006000
#define USBD_STATUS_DEVICE_GONE 0xC0007000
#define USBD_STATUS_NO_MEMORY 0x80000100
#define USBD_STATUS_INVALID_URB_FUNCTION 0x80000200
#define USBD_STATUS_INVALID_PARAMETER 0x80000300
#define USBD_STATUS_REQUEST_FAILED 0x80000500
#define USBD_STATUS_INVALID_PIPE_HANDLE 0x80000600
#define USBD_STATUS_ERROR_SHORT_TRANSFER 0x80000900
#define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE PAGE_SIZE
struct urb_hcd_area {
void *reserved8[8];
};
struct usbd_pipe_information {
USHORT wMaxPacketSize;
UCHAR bEndpointAddress;
UCHAR bInterval;
enum pipe_type type;
struct usb_endpoint_descriptor *handle;
ULONG max_tx_size;
ULONG flags;
};
struct usbd_interface_information {
USHORT bLength;
UCHAR bInterfaceNumber;
UCHAR bAlternateSetting;
UCHAR bInterfaceClass;
UCHAR bInterfaceSubClass;
UCHAR bInterfaceProtocol;
UCHAR reserved;
void *handle;
ULONG bNumEndpoints;
struct usbd_pipe_information pipes[1];
};
struct usbd_interface_list_entry {
struct usb_interface_descriptor *intf_desc;
struct usbd_interface_information *intf;
};
struct nt_urb_header {
USHORT length;
USHORT function;
USBD_STATUS status;
void *usbd_dev_handle;
ULONG usbd_flags;
};
struct usbd_select_interface {
struct nt_urb_header header;
void *handle;
struct usbd_interface_information intf;
};
struct usbd_select_configuration {
struct nt_urb_header header;
struct usb_config_descriptor *config;
void *handle;
struct usbd_interface_information intf;
};
struct usbd_control_descriptor_request {
struct nt_urb_header header;
void *reserved;
ULONG reserved0;
ULONG transfer_buffer_length;
void *transfer_buffer;
struct mdl *mdl;
union nt_urb *urb_link;
struct urb_hcd_area hca;
USHORT reserved1;
UCHAR index;
UCHAR desc_type;
USHORT language_id;
USHORT reserved2;
};
struct usbd_bulk_or_intr_transfer {
struct nt_urb_header header;
struct usb_endpoint_descriptor *pipe_handle;
ULONG transfer_flags;
ULONG transfer_buffer_length;
void *transfer_buffer;
struct mdl *mdl;
union nt_urb *urb_link;
struct urb_hcd_area hca;
};
struct usbd_pipe_request {
struct nt_urb_header header;
struct usb_endpoint_descriptor *pipe_handle;
};
struct usbd_vendor_or_class_request {
struct nt_urb_header header;
void *reserved;
ULONG transfer_flags;
ULONG transfer_buffer_length;
void *transfer_buffer;
struct mdl *mdl;
union nt_urb *link;
struct urb_hcd_area hca;
UCHAR reserved_bits;
UCHAR request;
USHORT value;
USHORT index;
USHORT reserved1;
};
struct urb_control_feature_request {
struct nt_urb_header header;
void *reserved;
ULONG reserved2;
ULONG reserved3;
void *reserved4;
struct mdl *reserved5;
union nt_urb *link;
struct urb_hcd_area hca;
USHORT reserved0;
USHORT feature_selector;
USHORT index;
USHORT reserved1;
};
struct urb_control_get_status_request {
struct nt_urb_header header;
void *reserved;
ULONG reserved0;
ULONG transfer_buffer_length;
void *transfer_buffer;
struct mdl *mdl;
union nt_urb *link;
struct urb_hcd_area hca;
UCHAR reserved1[4];
USHORT index;
USHORT reserved2;
};
struct usbd_iso_packet_desc {
ULONG offset;
ULONG length;
USBD_STATUS status;
};
struct usbd_isochronous_transfer {
struct nt_urb_header header;
struct usb_endpoint_descriptor *pipe_handle;
ULONG transfer_flags;
ULONG transfer_buffer_length;
void *transfer_buffer;
struct mdl *mdl;
union nt_urb *urb_link;
struct urb_hcd_area hca;
ULONG start_frame;
ULONG number_of_packets;
ULONG error_count;
struct usbd_iso_packet_desc iso_packet[1];
};
union nt_urb {
struct nt_urb_header header;
struct usbd_select_interface select_intf;
struct usbd_select_configuration select_conf;
struct usbd_bulk_or_intr_transfer bulk_int_transfer;
struct usbd_control_descriptor_request control_desc;
struct usbd_vendor_or_class_request vendor_class_request;
struct usbd_isochronous_transfer isochronous;
struct usbd_pipe_request pipe_req;
struct urb_control_feature_request feat_req;
struct urb_control_get_status_request status_req;
};
struct usbd_bus_interface_usbdi {
USHORT Size;
USHORT Version;
void *Context;
void *InterfaceReference;
void *InterfaceDereference;
void *GetUSBDIVersion;
void *QueryBusTime;
void *SubmitIsoOutUrb;
void *QueryBusInformation;
/* version 1 and above have following field */
void *IsDeviceHighSpeed;
/* version 2 (and above) have following field */
void *LogEntry;
};
struct usbd_bus_information_level {
ULONG TotalBandwidth;
ULONG ConsumedBandwidth;
/* level 1 and above have following fields */
ULONG ControllerNameLength;
wchar_t ControllerName[1];
};
#define USBDI_VERSION_XP 0x00000500 // Windows XP
#define USB_HCD_CAPS_SUPPORTS_RT_THREADS 0x00000001
#define USB_BUSIF_USBDI_VERSION_0 0x0000
#define USB_BUSIF_USBDI_VERSION_1 0x0001
#define USB_BUSIF_USBDI_VERSION_2 0x0002
struct usbd_version_info {
ULONG usbdi_version;
ULONG supported_usb_version;
};
struct usbd_idle_callback {
void *callback;
void *context;
};
#define NT_URB_STATUS(nt_urb) ((nt_urb)->header.status)
NTSTATUS wrap_submit_irp(struct device_object *pdo, struct irp *irp);
void wrap_suspend_urbs(struct wrap_device *wd);
void wrap_resume_urbs(struct wrap_device *wd);
NTSTATUS usb_query_interface(struct wrap_device *wd,
struct io_stack_location *irp_sl);
#endif /* USB_H */
|