1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct usb_device</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux-USB Host Side API"><link rel="up" href="hostside.html" title="Chapter 4. Host-Side Data Types and Macros"><link rel="prev" href="API-struct-usb-host-config.html" title="struct usb_host_config"><link rel="next" href="API-usb-hub-for-each-child.html" title="usb_hub_for_each_child"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct usb_device</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-usb-host-config.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Host-Side Data Types and Macros</th><td width="20%" align="right"> <a accesskey="n" href="API-usb-hub-for-each-child.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-usb-device"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct usb_device — 2 kernel's representation of a USB device 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct usb_device { 5 int devnum; 6 char devpath[16]; 7 u32 route; 8 enum usb_device_state state; 9 enum usb_device_speed speed; 10 struct usb_tt * tt; 11 int ttport; 12 unsigned int toggle[2]; 13 struct usb_device * parent; 14 struct usb_bus * bus; 15 struct usb_host_endpoint ep0; 16 struct device dev; 17 struct usb_device_descriptor descriptor; 18 struct usb_host_bos * bos; 19 struct usb_host_config * config; 20 struct usb_host_config * actconfig; 21 struct usb_host_endpoint * ep_in[16]; 22 struct usb_host_endpoint * ep_out[16]; 23 char ** rawdescriptors; 24 unsigned short bus_mA; 25 u8 portnum; 26 u8 level; 27 unsigned can_submit:1; 28 unsigned persist_enabled:1; 29 unsigned have_langid:1; 30 unsigned authorized:1; 31 unsigned authenticated:1; 32 unsigned wusb:1; 33 unsigned lpm_capable:1; 34 unsigned usb2_hw_lpm_capable:1; 35 unsigned usb2_hw_lpm_besl_capable:1; 36 unsigned usb2_hw_lpm_enabled:1; 37 unsigned usb2_hw_lpm_allowed:1; 38 unsigned usb3_lpm_enabled:1; 39 int string_langid; 40 char * product; 41 char * manufacturer; 42 char * serial; 43 struct list_head filelist; 44 int maxchild; 45 u32 quirks; 46 atomic_t urbnum; 47 unsigned long active_duration; 48#ifdef CONFIG_PM 49 unsigned long connect_time; 50 unsigned do_remote_wakeup:1; 51 unsigned reset_resume:1; 52 unsigned port_is_suspended:1; 53#endif 54 struct wusb_dev * wusb_dev; 55 int slot_id; 56 enum usb_device_removable removable; 57 struct usb2_lpm_parameters l1_params; 58 struct usb3_lpm_parameters u1_params; 59 struct usb3_lpm_parameters u2_params; 60 unsigned lpm_disable_count; 61}; </pre></div><div class="refsect1"><a name="idp1115596820"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">devnum</span></dt><dd><p> 62 device number; address on a USB bus 63 </p></dd><dt><span class="term">devpath[16]</span></dt><dd><p> 64 device ID string for use in messages (e.g., /port/...) 65 </p></dd><dt><span class="term">route</span></dt><dd><p> 66 tree topology hex string for use with xHCI 67 </p></dd><dt><span class="term">state</span></dt><dd><p> 68 device state: configured, not attached, etc. 69 </p></dd><dt><span class="term">speed</span></dt><dd><p> 70 device speed: high/full/low (or error) 71 </p></dd><dt><span class="term">tt</span></dt><dd><p> 72 Transaction Translator info; used with low/full speed dev, highspeed hub 73 </p></dd><dt><span class="term">ttport</span></dt><dd><p> 74 device port on that tt hub 75 </p></dd><dt><span class="term">toggle[2]</span></dt><dd><p> 76 one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints 77 </p></dd><dt><span class="term">parent</span></dt><dd><p> 78 our hub, unless we're the root 79 </p></dd><dt><span class="term">bus</span></dt><dd><p> 80 bus we're part of 81 </p></dd><dt><span class="term">ep0</span></dt><dd><p> 82 endpoint 0 data (default control pipe) 83 </p></dd><dt><span class="term">dev</span></dt><dd><p> 84 generic device interface 85 </p></dd><dt><span class="term">descriptor</span></dt><dd><p> 86 USB device descriptor 87 </p></dd><dt><span class="term">bos</span></dt><dd><p> 88 USB device BOS descriptor set 89 </p></dd><dt><span class="term">config</span></dt><dd><p> 90 all of the device's configs 91 </p></dd><dt><span class="term">actconfig</span></dt><dd><p> 92 the active configuration 93 </p></dd><dt><span class="term">ep_in[16]</span></dt><dd><p> 94 array of IN endpoints 95 </p></dd><dt><span class="term">ep_out[16]</span></dt><dd><p> 96 array of OUT endpoints 97 </p></dd><dt><span class="term">rawdescriptors</span></dt><dd><p> 98 raw descriptors for each config 99 </p></dd><dt><span class="term">bus_mA</span></dt><dd><p> 100 Current available from the bus 101 </p></dd><dt><span class="term">portnum</span></dt><dd><p> 102 parent port number (origin 1) 103 </p></dd><dt><span class="term">level</span></dt><dd><p> 104 number of USB hub ancestors 105 </p></dd><dt><span class="term">can_submit</span></dt><dd><p> 106 URBs may be submitted 107 </p></dd><dt><span class="term">persist_enabled</span></dt><dd><p> 108 USB_PERSIST enabled for this device 109 </p></dd><dt><span class="term">have_langid</span></dt><dd><p> 110 whether string_langid is valid 111 </p></dd><dt><span class="term">authorized</span></dt><dd><p> 112 policy has said we can use it; 113 (user space) policy determines if we authorize this device to be 114 used or not. By default, wired USB devices are authorized. 115 WUSB devices are not, until we authorize them from user space. 116 FIXME -- complete doc 117 </p></dd><dt><span class="term">authenticated</span></dt><dd><p> 118 Crypto authentication passed 119 </p></dd><dt><span class="term">wusb</span></dt><dd><p> 120 device is Wireless USB 121 </p></dd><dt><span class="term">lpm_capable</span></dt><dd><p> 122 device supports LPM 123 </p></dd><dt><span class="term">usb2_hw_lpm_capable</span></dt><dd><p> 124 device can perform USB2 hardware LPM 125 </p></dd><dt><span class="term">usb2_hw_lpm_besl_capable</span></dt><dd><p> 126 device can perform USB2 hardware BESL LPM 127 </p></dd><dt><span class="term">usb2_hw_lpm_enabled</span></dt><dd><p> 128 USB2 hardware LPM is enabled 129 </p></dd><dt><span class="term">usb2_hw_lpm_allowed</span></dt><dd><p> 130 Userspace allows USB 2.0 LPM to be enabled 131 </p></dd><dt><span class="term">usb3_lpm_enabled</span></dt><dd><p> 132 USB3 hardware LPM enabled 133 </p></dd><dt><span class="term">string_langid</span></dt><dd><p> 134 language ID for strings 135 </p></dd><dt><span class="term">product</span></dt><dd><p> 136 iProduct string, if present (static) 137 </p></dd><dt><span class="term">manufacturer</span></dt><dd><p> 138 iManufacturer string, if present (static) 139 </p></dd><dt><span class="term">serial</span></dt><dd><p> 140 iSerialNumber string, if present (static) 141 </p></dd><dt><span class="term">filelist</span></dt><dd><p> 142 usbfs files that are open to this device 143 </p></dd><dt><span class="term">maxchild</span></dt><dd><p> 144 number of ports if hub 145 </p></dd><dt><span class="term">quirks</span></dt><dd><p> 146 quirks of the whole device 147 </p></dd><dt><span class="term">urbnum</span></dt><dd><p> 148 number of URBs submitted for the whole device 149 </p></dd><dt><span class="term">active_duration</span></dt><dd><p> 150 total time device is not suspended 151 </p></dd><dt><span class="term">connect_time</span></dt><dd><p> 152 time device was first connected 153 </p></dd><dt><span class="term">do_remote_wakeup</span></dt><dd><p> 154 remote wakeup should be enabled 155 </p></dd><dt><span class="term">reset_resume</span></dt><dd><p> 156 needs reset instead of resume 157 </p></dd><dt><span class="term">port_is_suspended</span></dt><dd><p> 158 the upstream port is suspended (L2 or U3) 159 </p></dd><dt><span class="term">wusb_dev</span></dt><dd><p> 160 if this is a Wireless USB device, link to the WUSB 161 specific data for the device. 162 </p></dd><dt><span class="term">slot_id</span></dt><dd><p> 163 Slot ID assigned by xHCI 164 </p></dd><dt><span class="term">removable</span></dt><dd><p> 165 Device can be physically removed from this port 166 </p></dd><dt><span class="term">l1_params</span></dt><dd><p> 167 best effor service latency for USB2 L1 LPM state, and L1 timeout. 168 </p></dd><dt><span class="term">u1_params</span></dt><dd><p> 169 exit latencies for USB3 U1 LPM state, and hub-initiated timeout. 170 </p></dd><dt><span class="term">u2_params</span></dt><dd><p> 171 exit latencies for USB3 U2 LPM state, and hub-initiated timeout. 172 </p></dd><dt><span class="term">lpm_disable_count</span></dt><dd><p> 173 Ref count used by <code class="function">usb_disable_lpm</code> and <code class="function">usb_enable_lpm</code> 174 to keep track of the number of functions that require USB 3.0 Link Power 175 Management to be disabled for this usb_device. This count should only 176 be manipulated by those functions, with the bandwidth_mutex is held. 177 </p></dd></dl></div></div><div class="refsect1"><a name="idp1115635876"></a><h2>Notes</h2><p> 178 Usbcore drivers should not set usbdev->state directly. Instead use 179 <code class="function">usb_set_device_state</code>. 180</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-usb-host-config.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="hostside.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-usb-hub-for-each-child.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct usb_host_config</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">usb_hub_for_each_child</span></td></tr></table></div></body></html> 181