aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h168
1 files changed, 104 insertions, 64 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7e31cacfe69c..285011d9af17 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -341,102 +341,142 @@ struct usb_bus {
341 341
342struct usb_tt; 342struct usb_tt;
343 343
344/* 344/**
345 * struct usb_device - kernel's representation of a USB device 345 * struct usb_device - kernel's representation of a USB device
346 * 346 * @devnum: device number; address on a USB bus
347 * FIXME: Write the kerneldoc! 347 * @devpath: device ID string for use in messages (e.g., /port/...)
348 * 348 * @state: device state: configured, not attached, etc.
349 * @speed: device speed: high/full/low (or error)
350 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
351 * @ttport: device port on that tt hub
352 * @toggle: one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
353 * @parent: our hub, unless we're the root
354 * @bus: bus we're part of
355 * @ep0: endpoint 0 data (default control pipe)
356 * @dev: generic device interface
357 * @descriptor: USB device descriptor
358 * @config: all of the device's configs
359 * @actconfig: the active configuration
360 * @ep_in: array of IN endpoints
361 * @ep_out: array of OUT endpoints
362 * @rawdescriptors: raw descriptors for each config
363 * @bus_mA: Current available from the bus
364 * @portnum: parent port number (origin 1)
365 * @level: number of USB hub ancestors
366 * @can_submit: URBs may be submitted
367 * @discon_suspended: disconnected while suspended
368 * @persist_enabled: USB_PERSIST enabled for this device
369 * @have_langid: whether string_langid is valid
370 * @authorized: policy has said we can use it;
371 * (user space) policy determines if we authorize this device to be
372 * used or not. By default, wired USB devices are authorized.
373 * WUSB devices are not, until we authorize them from user space.
374 * FIXME -- complete doc
375 * @wusb: device is Wireless USB
376 * @string_langid: language ID for strings
377 * @product: iProduct string, if present (static)
378 * @manufacturer: iManufacturer string, if present (static)
379 * @serial: iSerialNumber string, if present (static)
380 * @filelist: usbfs files that are open to this device
381 * @usb_classdev: USB class device that was created for usbfs device
382 * access from userspace
383 * @usbfs_dentry: usbfs dentry entry for the device
384 * @maxchild: number of ports if hub
385 * @children: child devices - USB devices that are attached to this hub
386 * @pm_usage_cnt: usage counter for autosuspend
387 * @quirks: quirks of the whole device
388 * @urbnum: number of URBs submitted for the whole device
389 * @active_duration: total time device is not suspended
390 * @autosuspend: for delayed autosuspends
391 * @pm_mutex: protects PM operations
392 * @last_busy: time of last use
393 * @autosuspend_delay: in jiffies
394 * @connect_time: time device was first connected
395 * @auto_pm: autosuspend/resume in progress
396 * @do_remote_wakeup: remote wakeup should be enabled
397 * @reset_resume: needs reset instead of resume
398 * @autosuspend_disabled: autosuspend disabled by the user
399 * @autoresume_disabled: autoresume disabled by the user
400 * @skip_sys_resume: skip the next system resume
401 *
402 * Notes:
349 * Usbcore drivers should not set usbdev->state directly. Instead use 403 * Usbcore drivers should not set usbdev->state directly. Instead use
350 * usb_set_device_state(). 404 * usb_set_device_state().
351 *
352 * @authorized: (user space) policy determines if we authorize this
353 * device to be used or not. By default, wired USB
354 * devices are authorized. WUSB devices are not, until we
355 * authorize them from user space. FIXME -- complete doc
356 */ 405 */
357struct usb_device { 406struct usb_device {
358 int devnum; /* Address on USB bus */ 407 int devnum;
359 char devpath [16]; /* Use in messages: /port/port/... */ 408 char devpath [16];
360 enum usb_device_state state; /* configured, not attached, etc */ 409 enum usb_device_state state;
361 enum usb_device_speed speed; /* high/full/low (or error) */ 410 enum usb_device_speed speed;
362 411
363 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 412 struct usb_tt *tt;
364 int ttport; /* device port on that tt hub */ 413 int ttport;
365 414
366 unsigned int toggle[2]; /* one bit for each endpoint 415 unsigned int toggle[2];
367 * ([0] = IN, [1] = OUT) */
368 416
369 struct usb_device *parent; /* our hub, unless we're the root */ 417 struct usb_device *parent;
370 struct usb_bus *bus; /* Bus we're part of */ 418 struct usb_bus *bus;
371 struct usb_host_endpoint ep0; 419 struct usb_host_endpoint ep0;
372 420
373 struct device dev; /* Generic device interface */ 421 struct device dev;
374 422
375 struct usb_device_descriptor descriptor;/* Descriptor */ 423 struct usb_device_descriptor descriptor;
376 struct usb_host_config *config; /* All of the configs */ 424 struct usb_host_config *config;
377 425
378 struct usb_host_config *actconfig;/* the active configuration */ 426 struct usb_host_config *actconfig;
379 struct usb_host_endpoint *ep_in[16]; 427 struct usb_host_endpoint *ep_in[16];
380 struct usb_host_endpoint *ep_out[16]; 428 struct usb_host_endpoint *ep_out[16];
381 429
382 char **rawdescriptors; /* Raw descriptors for each config */ 430 char **rawdescriptors;
383 431
384 unsigned short bus_mA; /* Current available from the bus */ 432 unsigned short bus_mA;
385 u8 portnum; /* Parent port number (origin 1) */ 433 u8 portnum;
386 u8 level; /* Number of USB hub ancestors */ 434 u8 level;
387 435
388 unsigned can_submit:1; /* URBs may be submitted */ 436 unsigned can_submit:1;
389 unsigned discon_suspended:1; /* Disconnected while suspended */ 437 unsigned discon_suspended:1;
390 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ 438 unsigned persist_enabled:1;
391 unsigned have_langid:1; /* whether string_langid is valid */ 439 unsigned have_langid:1;
392 unsigned authorized:1; /* Policy has said we can use it */ 440 unsigned authorized:1;
393 unsigned wusb:1; /* Device is Wireless USB */ 441 unsigned wusb:1;
394 int string_langid; /* language ID for strings */ 442 int string_langid;
395 443
396 /* static strings from the device */ 444 /* static strings from the device */
397 char *product; /* iProduct string, if present */ 445 char *product;
398 char *manufacturer; /* iManufacturer string, if present */ 446 char *manufacturer;
399 char *serial; /* iSerialNumber string, if present */ 447 char *serial;
400 448
401 struct list_head filelist; 449 struct list_head filelist;
402#ifdef CONFIG_USB_DEVICE_CLASS 450#ifdef CONFIG_USB_DEVICE_CLASS
403 struct device *usb_classdev; 451 struct device *usb_classdev;
404#endif 452#endif
405#ifdef CONFIG_USB_DEVICEFS 453#ifdef CONFIG_USB_DEVICEFS
406 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 454 struct dentry *usbfs_dentry;
407#endif 455#endif
408 /*
409 * Child devices - these can be either new devices
410 * (if this is a hub device), or different instances
411 * of this same device.
412 *
413 * Each instance needs its own set of data structures.
414 */
415 456
416 int maxchild; /* Number of ports if hub */ 457 int maxchild;
417 struct usb_device *children[USB_MAXCHILDREN]; 458 struct usb_device *children[USB_MAXCHILDREN];
418 459
419 int pm_usage_cnt; /* usage counter for autosuspend */ 460 int pm_usage_cnt;
420 u32 quirks; /* quirks of the whole device */ 461 u32 quirks;
421 atomic_t urbnum; /* number of URBs submitted for 462 atomic_t urbnum;
422 the whole device */
423 463
424 unsigned long active_duration; /* total time device is not suspended */ 464 unsigned long active_duration;
425 465
426#ifdef CONFIG_PM 466#ifdef CONFIG_PM
427 struct delayed_work autosuspend; /* for delayed autosuspends */ 467 struct delayed_work autosuspend;
428 struct mutex pm_mutex; /* protects PM operations */ 468 struct mutex pm_mutex;
429 469
430 unsigned long last_busy; /* time of last use */ 470 unsigned long last_busy;
431 int autosuspend_delay; /* in jiffies */ 471 int autosuspend_delay;
432 unsigned long connect_time; /* time device was first connected */ 472 unsigned long connect_time;
433 473
434 unsigned auto_pm:1; /* autosuspend/resume in progress */ 474 unsigned auto_pm:1;
435 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 475 unsigned do_remote_wakeup:1;
436 unsigned reset_resume:1; /* needs reset instead of resume */ 476 unsigned reset_resume:1;
437 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 477 unsigned autosuspend_disabled:1;
438 unsigned autoresume_disabled:1; /* disabled by the user */ 478 unsigned autoresume_disabled:1;
439 unsigned skip_sys_resume:1; /* skip the next system resume */ 479 unsigned skip_sys_resume:1;
440#endif 480#endif
441}; 481};
442#define to_usb_device(d) container_of(d, struct usb_device, dev) 482#define to_usb_device(d) container_of(d, struct usb_device, dev)