1 /* $NetBSD: usb.h,v 1.38 1999/10/20 21:02:39 augustss Exp $ */ 2 /* $FreeBSD$ */ 3 4 /* 5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Lennart Augustsson (augustss@carlstedt.se) at 10 * Carlstedt Research & Technology. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the NetBSD 23 * Foundation, Inc. and its contributors. 24 * 4. Neither the name of The NetBSD Foundation nor the names of its 25 * contributors may be used to endorse or promote products derived 26 * from this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 */ 40 41 42 #ifndef _USB_H_ 43 #define _USB_H_ 44 45 #include <sys/types.h> 46 #include <sys/time.h> 47 48 #if defined(__NetBSD__) || defined(__OpenBSD__) 49 #include <sys/ioctl.h> 50 51 #if defined(_KERNEL) 52 #include <dev/usb/usb_port.h> 53 #endif /* _KERNEL */ 54 55 #elif defined(__FreeBSD__) 56 #if defined(_KERNEL) 57 #include <sys/malloc.h> 58 59 MALLOC_DECLARE(M_USB); 60 MALLOC_DECLARE(M_USBDEV); 61 MALLOC_DECLARE(M_USBHC); 62 63 #include <dev/usb/usb_port.h> 64 #endif /* _KERNEL */ 65 #endif /* __FreeBSD__ */ 66 67 /* these three defines are used by usbd to autoload the usb kld */ 68 #define USB_KLD "usb" 69 #define USB_OHCI "ohci/usb" 70 #define USB_UHCI "uhci/usb" 71 72 #define USB_MAX_DEVICES 128 73 #define USB_START_ADDR 0 74 75 #define USB_CONTROL_ENDPOINT 0 76 #define USB_MAX_ENDPOINTS 16 77 78 #define USB_FRAMES_PER_SECOND 1000 79 80 /* 81 * The USB records contain some unaligned little-endian word 82 * components. The U[SG]ETW macros take care of both the alignment 83 * and endian problem and should always be used to access 16 bit 84 * values. 85 */ 86 typedef u_int8_t uByte; 87 typedef u_int8_t uWord[2]; 88 #define UGETW(w) ((w)[0] | ((w)[1] << 8)) 89 #define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8)) 90 #define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h)) 91 typedef u_int8_t uDWord[4]; 92 #define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24)) 93 #define USETDW(w,v) ((w)[0] = (u_int8_t)(v), \ 94 (w)[1] = (u_int8_t)((v) >> 8), \ 95 (w)[2] = (u_int8_t)((v) >> 16), \ 96 (w)[3] = (u_int8_t)((v) >> 24)) 97 /* 98 * On little-endian machines that can handle unanliged accesses 99 * (e.g. i386) these macros can be replaced by the following. 100 */ 101 #if 0 102 #define UGETW(w) (*(u_int16_t *)(w)) 103 #define USETW(w,v) (*(u_int16_t *)(w) = (v)) 104 #endif 105 106 typedef struct { 107 uByte bmRequestType; 108 uByte bRequest; 109 uWord wValue; 110 uWord wIndex; 111 uWord wLength; 112 } usb_device_request_t; 113 114 #define UT_WRITE 0x00 115 #define UT_READ 0x80 116 #define UT_STANDARD 0x00 117 #define UT_CLASS 0x20 118 #define UT_VENDOR 0x40 119 #define UT_DEVICE 0x00 120 #define UT_INTERFACE 0x01 121 #define UT_ENDPOINT 0x02 122 #define UT_OTHER 0x03 123 124 #define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE) 125 #define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE) 126 #define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT) 127 #define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE) 128 #define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE) 129 #define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT) 130 #define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE) 131 #define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE) 132 #define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER) 133 #define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT) 134 #define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE) 135 #define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE) 136 #define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER) 137 #define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT) 138 #define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) 139 #define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE) 140 #define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER) 141 #define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT) 142 #define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE) 143 #define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE) 144 #define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER) 145 #define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT) 146 147 /* Requests */ 148 #define UR_GET_STATUS 0x00 149 #define UR_CLEAR_FEATURE 0x01 150 #define UR_SET_FEATURE 0x03 151 #define UR_SET_ADDRESS 0x05 152 #define UR_GET_DESCRIPTOR 0x06 153 #define UDESC_DEVICE 0x01 154 #define UDESC_CONFIG 0x02 155 #define UDESC_STRING 0x03 156 #define UDESC_INTERFACE 0x04 157 #define UDESC_ENDPOINT 0x05 158 #define UDESC_CS_DEVICE 0x21 /* class specific */ 159 #define UDESC_CS_CONFIG 0x22 160 #define UDESC_CS_STRING 0x23 161 #define UDESC_CS_INTERFACE 0x24 162 #define UDESC_CS_ENDPOINT 0x25 163 #define UDESC_HUB 0x29 164 #define UR_SET_DESCRIPTOR 0x07 165 #define UR_GET_CONFIG 0x08 166 #define UR_SET_CONFIG 0x09 167 #define UR_GET_INTERFACE 0x0a 168 #define UR_SET_INTERFACE 0x0b 169 #define UR_SYNCH_FRAME 0x0c 170 171 /* Feature numbers */ 172 #define UF_ENDPOINT_HALT 0 173 #define UF_DEVICE_REMOTE_WAKEUP 1 174 175 #define USB_MAX_IPACKET 8 /* maximum size of the initial packet */ 176 177 typedef struct { 178 uByte bLength; 179 uByte bDescriptorType; 180 uByte bDescriptorSubtype; 181 } usb_descriptor_t; 182 183 typedef struct { 184 uByte bLength; 185 uByte bDescriptorType; 186 uWord bcdUSB; 187 uByte bDeviceClass; 188 uByte bDeviceSubClass; 189 uByte bDeviceProtocol; 190 uByte bMaxPacketSize; 191 /* The fields below are not part of the initial descriptor. */ 192 uWord idVendor; 193 uWord idProduct; 194 uWord bcdDevice; 195 uByte iManufacturer; 196 uByte iProduct; 197 uByte iSerialNumber; 198 uByte bNumConfigurations; 199 } usb_device_descriptor_t; 200 #define USB_DEVICE_DESCRIPTOR_SIZE 18 201 202 typedef struct { 203 uByte bLength; 204 uByte bDescriptorType; 205 uWord wTotalLength; 206 uByte bNumInterface; 207 uByte bConfigurationValue; 208 uByte iConfiguration; 209 uByte bmAttributes; 210 #define UC_BUS_POWERED 0x80 211 #define UC_SELF_POWERED 0x40 212 #define UC_REMOTE_WAKEUP 0x20 213 uByte bMaxPower; /* max current in 2 mA units */ 214 #define UC_POWER_FACTOR 2 215 } usb_config_descriptor_t; 216 #define USB_CONFIG_DESCRIPTOR_SIZE 9 217 218 typedef struct { 219 uByte bLength; 220 uByte bDescriptorType; 221 uByte bInterfaceNumber; 222 uByte bAlternateSetting; 223 uByte bNumEndpoints; 224 uByte bInterfaceClass; 225 uByte bInterfaceSubClass; 226 uByte bInterfaceProtocol; 227 uByte iInterface; 228 } usb_interface_descriptor_t; 229 #define USB_INTERFACE_DESCRIPTOR_SIZE 9 230 231 typedef struct { 232 uByte bLength; 233 uByte bDescriptorType; 234 uByte bEndpointAddress; 235 #define UE_GET_DIR(a) ((a) & 0x80) 236 #define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) 237 #define UE_DIR_IN 0x80 238 #define UE_DIR_OUT 0x00 239 #define UE_ADDR 0x0f 240 #define UE_GET_ADDR(a) ((a) & UE_ADDR) 241 uByte bmAttributes; 242 #define UE_XFERTYPE 0x03 243 #define UE_CONTROL 0x00 244 #define UE_ISOCHRONOUS 0x01 245 #define UE_BULK 0x02 246 #define UE_INTERRUPT 0x03 247 #define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE) 248 #define UE_ISO_TYPE 0x0c 249 #define UE_ISO_ASYNC 0x04 250 #define UE_ISO_ADAPT 0x08 251 #define UE_ISO_SYNC 0x0c 252 #define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE) 253 uWord wMaxPacketSize; 254 uByte bInterval; 255 } usb_endpoint_descriptor_t; 256 #define USB_ENDPOINT_DESCRIPTOR_SIZE 7 257 258 typedef struct { 259 uByte bLength; 260 uByte bDescriptorType; 261 uWord bString[127]; 262 } usb_string_descriptor_t; 263 #define USB_MAX_STRING_LEN 128 264 #define USB_LANGUAGE_TABLE 0 /* # of the string language id table */ 265 266 /* Hub specific request */ 267 #define UR_GET_BUS_STATE 0x02 268 269 /* Hub features */ 270 #define UHF_C_HUB_LOCAL_POWER 0 271 #define UHF_C_HUB_OVER_CURRENT 1 272 #define UHF_PORT_CONNECTION 0 273 #define UHF_PORT_ENABLE 1 274 #define UHF_PORT_SUSPEND 2 275 #define UHF_PORT_OVER_CURRENT 3 276 #define UHF_PORT_RESET 4 277 #define UHF_PORT_POWER 8 278 #define UHF_PORT_LOW_SPEED 9 279 #define UHF_C_PORT_CONNECTION 16 280 #define UHF_C_PORT_ENABLE 17 281 #define UHF_C_PORT_SUSPEND 18 282 #define UHF_C_PORT_OVER_CURRENT 19 283 #define UHF_C_PORT_RESET 20 284 285 typedef struct { 286 uByte bDescLength; 287 uByte bDescriptorType; 288 uByte bNbrPorts; 289 uWord wHubCharacteristics; 290 #define UHD_PWR 0x03 291 #define UHD_PWR_GANGED 0x00 292 #define UHD_PWR_INDIVIDUAL 0x01 293 #define UHD_PWR_NO_SWITCH 0x02 294 #define UHD_COMPOUND 0x04 295 #define UHD_OC 0x18 296 #define UHD_OC_GLOBAL 0x00 297 #define UHD_OC_INDIVIDUAL 0x08 298 #define UHD_OC_NONE 0x10 299 uByte bPwrOn2PwrGood; /* delay in 2 ms units */ 300 #define UHD_PWRON_FACTOR 2 301 uByte bHubContrCurrent; 302 uByte DeviceRemovable[32]; /* max 255 ports */ 303 #define UHD_NOT_REMOV(desc, i) \ 304 (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1) 305 /* deprecated uByte PortPowerCtrlMask[]; */ 306 } usb_hub_descriptor_t; 307 #define USB_HUB_DESCRIPTOR_SIZE 8 308 309 typedef struct { 310 uWord wStatus; 311 /* Device status flags */ 312 #define UDS_SELF_POWERED 0x0001 313 #define UDS_REMOTE_WAKEUP 0x0002 314 /* Endpoint status flags */ 315 #define UES_HALT 0x0001 316 } usb_status_t; 317 318 typedef struct { 319 uWord wHubStatus; 320 #define UHS_LOCAL_POWER 0x0001 321 #define UHS_OVER_CURRENT 0x0002 322 uWord wHubChange; 323 } usb_hub_status_t; 324 325 typedef struct { 326 uWord wPortStatus; 327 #define UPS_CURRENT_CONNECT_STATUS 0x0001 328 #define UPS_PORT_ENABLED 0x0002 329 #define UPS_SUSPEND 0x0004 330 #define UPS_OVERCURRENT_INDICATOR 0x0008 331 #define UPS_RESET 0x0010 332 #define UPS_PORT_POWER 0x0100 333 #define UPS_LOW_SPEED 0x0200 334 uWord wPortChange; 335 #define UPS_C_CONNECT_STATUS 0x0001 336 #define UPS_C_PORT_ENABLED 0x0002 337 #define UPS_C_SUSPEND 0x0004 338 #define UPS_C_OVERCURRENT_INDICATOR 0x0008 339 #define UPS_C_PORT_RESET 0x0010 340 } usb_port_status_t; 341 342 #define UCLASS_UNSPEC 0 343 #define UCLASS_AUDIO 1 344 #define USUBCLASS_AUDIOCONTROL 1 345 #define USUBCLASS_AUDIOSTREAM 2 346 #define USUBCLASS_MIDISTREAM 3 347 #define UCLASS_CDC 2 /* communication */ 348 #define USUBCLASS_DIRECT_LINE_CONTROL_MODEL 1 349 #define USUBCLASS_ABSTRACT_CONTROL_MODEL 2 350 #define USUBCLASS_TELEPHONE_CONTROL_MODEL 3 351 #define USUBCLASS_MULTICHANNEL_CONTROL_MODEL 4 352 #define USUBCLASS_CAPI_CONTROLMODEL 5 353 #define USUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6 354 #define USUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7 355 #define UPROTO_CDC_AT 1 356 #define UCLASS_HID 3 357 #define USUBCLASS_BOOT 1 358 #define UCLASS_PRINTER 7 359 #define USUBCLASS_PRINTER 1 360 #define UPROTO_PRINTER_UNI 1 361 #define UPROTO_PRINTER_BI 2 362 #define UCLASS_MASS 8 363 #define USUBCLASS_RBC 1 364 #define USUBCLASS_SFF8020I 2 365 #define USUBCLASS_QIC157 3 366 #define USUBCLASS_UFI 4 367 #define USUBCLASS_SFF8070I 5 368 #define USUBCLASS_SCSI 6 369 #define UPROTO_MASS_CBI_I 0 370 #define UPROTO_MASS_CBI 1 371 #define UPROTO_MASS_BBB 2 372 #define UPROTO_MASS_BBB_P 80 /* 'P' for the Iomega Zip drive */ 373 #define UCLASS_HUB 9 374 #define USUBCLASS_HUB 0 375 #define UCLASS_DATA 10 376 #define USUBCLASS_DATA 0 377 #define UPROTO_DATA_ISDNBRI 0x30 /* Physical iface */ 378 #define UPROTO_DATA_HDLC 0x31 /* HDLC */ 379 #define UPROTO_DATA_TRANSPARENT 0x32 /* Transparent */ 380 #define UPROTO_DATA_Q921M 0x50 /* Management for Q921 */ 381 #define UPROTO_DATA_Q921 0x51 /* Data for Q921 */ 382 #define UPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */ 383 #define UPROTO_DATA_V42BIS 0x90 /* Data compression */ 384 #define UPROTO_DATA_Q931 0x91 /* Euro-ISDN */ 385 #define UPROTO_DATA_V120 0x92 /* V.24 rate adaption */ 386 #define UPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */ 387 #define UPROTO_DATA_HOST_BASED 0xfd /* Host based driver */ 388 #define UPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/ 389 #define UPROTO_DATA_VENDOR 0xff /* Vendor specific */ 390 391 392 #define USB_HUB_MAX_DEPTH 5 393 394 /* 395 * Minimum time a device needs to be powered down to go through 396 * a power cycle. XXX Are these time in the spec? 397 */ 398 #define USB_POWER_DOWN_TIME 200 /* ms */ 399 #define USB_PORT_POWER_DOWN_TIME 100 /* ms */ 400 401 #if 0 402 /* These are the values from the spec. */ 403 #define USB_PORT_RESET_DELAY 10 /* ms */ 404 #define USB_PORT_RESET_SETTLE 10 /* ms */ 405 #define USB_PORT_POWERUP_DELAY 100 /* ms */ 406 #define USB_SET_ADDRESS_SETTLE 2 /* ms */ 407 #define USB_RESUME_TIME (20*5) /* ms */ 408 #define USB_RESUME_WAIT 10 /* ms */ 409 #define USB_RESUME_RECOVERY 10 /* ms */ 410 #else 411 /* Allow for marginal (i.e. non-conforming) devices. */ 412 #define USB_PORT_RESET_DELAY 50 /* ms */ 413 #define USB_PORT_RESET_RECOVERY 50 /* ms */ 414 #define USB_PORT_POWERUP_DELAY 200 /* ms */ 415 #define USB_SET_ADDRESS_SETTLE 10 /* ms */ 416 #define USB_RESUME_DELAY (50*5) /* ms */ 417 #define USB_RESUME_WAIT 50 /* ms */ 418 #define USB_RESUME_RECOVERY 50 /* ms */ 419 #endif 420 421 #define USB_MIN_POWER 100 /* mA */ 422 #define USB_MAX_POWER 500 /* mA */ 423 424 #define USB_BUS_RESET_DELAY 100 /* ms XXX?*/ 425 426 /*** ioctl() related stuff ***/ 427 428 struct usb_ctl_request { 429 int addr; 430 usb_device_request_t request; 431 void *data; 432 int flags; 433 #define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ 434 int actlen; /* actual length transferred */ 435 }; 436 437 struct usb_alt_interface { 438 int config_index; 439 int interface_index; 440 int alt_no; 441 }; 442 443 #define USB_CURRENT_CONFIG_INDEX (-1) 444 #define USB_CURRENT_ALT_INDEX (-1) 445 446 struct usb_config_desc { 447 int config_index; 448 usb_config_descriptor_t desc; 449 }; 450 451 struct usb_interface_desc { 452 int config_index; 453 int interface_index; 454 int alt_index; 455 usb_interface_descriptor_t desc; 456 }; 457 458 struct usb_endpoint_desc { 459 int config_index; 460 int interface_index; 461 int alt_index; 462 int endpoint_index; 463 usb_endpoint_descriptor_t desc; 464 }; 465 466 struct usb_full_desc { 467 int config_index; 468 u_int size; 469 u_char *data; 470 }; 471 472 struct usb_string_desc { 473 int string_index; 474 int language_id; 475 usb_string_descriptor_t desc; 476 }; 477 478 struct usb_ctl_report_desc { 479 int size; 480 u_char data[1024]; /* filled data size will vary */ 481 }; 482 483 struct usb_device_info { 484 u_int8_t bus; /* bus number */ 485 u_int8_t addr; /* device address */ 486 # define MAXDEVNAMELEN 10 /* number of drivers */ 487 # define MAXDEVNAMES 4 /* attached drivers */ 488 char devnames[MAXDEVNAMES][MAXDEVNAMELEN]; 489 /* device names */ 490 char product[USB_MAX_STRING_LEN]; /* iProduct */ 491 char vendor[USB_MAX_STRING_LEN]; /* iManufacturer */ 492 char release[8]; /* string of releaseNo*/ 493 u_int16_t productNo; /* idProduct */ 494 u_int16_t vendorNo; /* idVendor */ 495 u_int16_t releaseNo; /* bcdDevice */ 496 u_int8_t class; /* bDeviceClass */ 497 u_int8_t subclass; /* bDeviceSubclass */ 498 u_int8_t protocol; /* bDeviceProtocol */ 499 u_int8_t config; /* config index */ 500 u_int8_t lowspeed; /* lowsped yes/no */ 501 int power; /* power consumption in mA, 0 if selfpowered */ 502 int nports; /* 0 if not hub */ 503 u_int8_t ports[16];/* hub only: addresses of devices on ports */ 504 #define USB_PORT_ENABLED 0xff 505 #define USB_PORT_SUSPENDED 0xfe 506 #define USB_PORT_POWERED 0xfd 507 #define USB_PORT_DISABLED 0xfc 508 }; 509 510 struct usb_ctl_report { 511 int report; 512 u_char data[1024]; /* filled data size will vary */ 513 }; 514 515 struct usb_device_stats { 516 u_long requests[4]; /* indexed by transfer type UE_* */ 517 }; 518 519 typedef struct { u_int32_t cookie; } usb_event_cookie_t; 520 /* Events that can be read from /dev/usb */ 521 struct usb_event { 522 int ue_type; 523 #define USB_EVENT_ATTACH 1 524 #define USB_EVENT_DETACH 2 525 struct usb_device_info ue_device; 526 struct timespec ue_time; 527 usb_event_cookie_t ue_cookie; 528 }; 529 530 /* USB controller */ 531 #define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request) 532 #define USB_SETDEBUG _IOW ('U', 2, int) 533 #define USB_DISCOVER _IO ('U', 3) 534 #define USB_DEVICEINFO _IOWR('U', 4, struct usb_device_info) 535 #define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats) 536 537 /* Generic HID device */ 538 #define USB_GET_REPORT_DESC _IOR ('U', 21, struct usb_ctl_report_desc) 539 #define USB_SET_IMMED _IOW ('U', 22, int) 540 #define USB_GET_REPORT _IOWR('U', 23, struct usb_ctl_report) 541 542 /* Generic USB device */ 543 #define USB_GET_CONFIG _IOR ('U', 100, int) 544 #define USB_SET_CONFIG _IOW ('U', 101, int) 545 #define USB_GET_ALTINTERFACE _IOWR('U', 102, struct usb_alt_interface) 546 #define USB_SET_ALTINTERFACE _IOWR('U', 103, struct usb_alt_interface) 547 #define USB_GET_NO_ALT _IOWR('U', 104, struct usb_alt_interface) 548 #define USB_GET_DEVICE_DESC _IOR ('U', 105, usb_device_descriptor_t) 549 #define USB_GET_CONFIG_DESC _IOWR('U', 106, struct usb_config_desc) 550 #define USB_GET_INTERFACE_DESC _IOWR('U', 107, struct usb_interface_desc) 551 #define USB_GET_ENDPOINT_DESC _IOWR('U', 108, struct usb_endpoint_desc) 552 #define USB_GET_FULL_DESC _IOWR('U', 109, struct usb_full_desc) 553 #define USB_GET_STRING_DESC _IOWR('U', 110, struct usb_string_desc) 554 #define USB_DO_REQUEST _IOWR('U', 111, struct usb_ctl_request) 555 #define USB_GET_DEVICEINFO _IOR ('U', 112, struct usb_device_info) 556 #define USB_SET_SHORT_XFER _IOW ('U', 113, int) 557 #define USB_SET_TIMEOUT _IOW ('U', 114, int) 558 559 /* Modem device */ 560 #define USB_GET_CM_OVER_DATA _IOR ('U', 130, int) 561 #define USB_SET_CM_OVER_DATA _IOW ('U', 131, int) 562 563 #endif /* _USB_H_ */ 564