1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><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 unsigned usb3_lpm_u1_enabled:1; 40 unsigned usb3_lpm_u2_enabled:1; 41 int string_langid; 42 char * product; 43 char * manufacturer; 44 char * serial; 45 struct list_head filelist; 46 int maxchild; 47 u32 quirks; 48 atomic_t urbnum; 49 unsigned long active_duration; 50#ifdef CONFIG_PM 51 unsigned long connect_time; 52 unsigned do_remote_wakeup:1; 53 unsigned reset_resume:1; 54 unsigned port_is_suspended:1; 55#endif 56 struct wusb_dev * wusb_dev; 57 int slot_id; 58 enum usb_device_removable removable; 59 struct usb2_lpm_parameters l1_params; 60 struct usb3_lpm_parameters u1_params; 61 struct usb3_lpm_parameters u2_params; 62 unsigned lpm_disable_count; 63}; </pre></div><div class="refsect1"><a name="id-1.6.7.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">devnum</span></dt><dd><p> 64 device number; address on a USB bus 65 </p></dd><dt><span class="term">devpath[16]</span></dt><dd><p> 66 device ID string for use in messages (e.g., /port/...) 67 </p></dd><dt><span class="term">route</span></dt><dd><p> 68 tree topology hex string for use with xHCI 69 </p></dd><dt><span class="term">state</span></dt><dd><p> 70 device state: configured, not attached, etc. 71 </p></dd><dt><span class="term">speed</span></dt><dd><p> 72 device speed: high/full/low (or error) 73 </p></dd><dt><span class="term">tt</span></dt><dd><p> 74 Transaction Translator info; used with low/full speed dev, highspeed hub 75 </p></dd><dt><span class="term">ttport</span></dt><dd><p> 76 device port on that tt hub 77 </p></dd><dt><span class="term">toggle[2]</span></dt><dd><p> 78 one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints 79 </p></dd><dt><span class="term">parent</span></dt><dd><p> 80 our hub, unless we're the root 81 </p></dd><dt><span class="term">bus</span></dt><dd><p> 82 bus we're part of 83 </p></dd><dt><span class="term">ep0</span></dt><dd><p> 84 endpoint 0 data (default control pipe) 85 </p></dd><dt><span class="term">dev</span></dt><dd><p> 86 generic device interface 87 </p></dd><dt><span class="term">descriptor</span></dt><dd><p> 88 USB device descriptor 89 </p></dd><dt><span class="term">bos</span></dt><dd><p> 90 USB device BOS descriptor set 91 </p></dd><dt><span class="term">config</span></dt><dd><p> 92 all of the device's configs 93 </p></dd><dt><span class="term">actconfig</span></dt><dd><p> 94 the active configuration 95 </p></dd><dt><span class="term">ep_in[16]</span></dt><dd><p> 96 array of IN endpoints 97 </p></dd><dt><span class="term">ep_out[16]</span></dt><dd><p> 98 array of OUT endpoints 99 </p></dd><dt><span class="term">rawdescriptors</span></dt><dd><p> 100 raw descriptors for each config 101 </p></dd><dt><span class="term">bus_mA</span></dt><dd><p> 102 Current available from the bus 103 </p></dd><dt><span class="term">portnum</span></dt><dd><p> 104 parent port number (origin 1) 105 </p></dd><dt><span class="term">level</span></dt><dd><p> 106 number of USB hub ancestors 107 </p></dd><dt><span class="term">can_submit</span></dt><dd><p> 108 URBs may be submitted 109 </p></dd><dt><span class="term">persist_enabled</span></dt><dd><p> 110 USB_PERSIST enabled for this device 111 </p></dd><dt><span class="term">have_langid</span></dt><dd><p> 112 whether string_langid is valid 113 </p></dd><dt><span class="term">authorized</span></dt><dd><p> 114 policy has said we can use it; 115 (user space) policy determines if we authorize this device to be 116 used or not. By default, wired USB devices are authorized. 117 WUSB devices are not, until we authorize them from user space. 118 FIXME -- complete doc 119 </p></dd><dt><span class="term">authenticated</span></dt><dd><p> 120 Crypto authentication passed 121 </p></dd><dt><span class="term">wusb</span></dt><dd><p> 122 device is Wireless USB 123 </p></dd><dt><span class="term">lpm_capable</span></dt><dd><p> 124 device supports LPM 125 </p></dd><dt><span class="term">usb2_hw_lpm_capable</span></dt><dd><p> 126 device can perform USB2 hardware LPM 127 </p></dd><dt><span class="term">usb2_hw_lpm_besl_capable</span></dt><dd><p> 128 device can perform USB2 hardware BESL LPM 129 </p></dd><dt><span class="term">usb2_hw_lpm_enabled</span></dt><dd><p> 130 USB2 hardware LPM is enabled 131 </p></dd><dt><span class="term">usb2_hw_lpm_allowed</span></dt><dd><p> 132 Userspace allows USB 2.0 LPM to be enabled 133 </p></dd><dt><span class="term">usb3_lpm_enabled</span></dt><dd><p> 134 USB3 hardware LPM enabled 135 </p></dd><dt><span class="term">usb3_lpm_u1_enabled</span></dt><dd><p> 136 USB3 hardware U1 LPM enabled 137 </p></dd><dt><span class="term">usb3_lpm_u2_enabled</span></dt><dd><p> 138 USB3 hardware U2 LPM enabled 139 </p></dd><dt><span class="term">string_langid</span></dt><dd><p> 140 language ID for strings 141 </p></dd><dt><span class="term">product</span></dt><dd><p> 142 iProduct string, if present (static) 143 </p></dd><dt><span class="term">manufacturer</span></dt><dd><p> 144 iManufacturer string, if present (static) 145 </p></dd><dt><span class="term">serial</span></dt><dd><p> 146 iSerialNumber string, if present (static) 147 </p></dd><dt><span class="term">filelist</span></dt><dd><p> 148 usbfs files that are open to this device 149 </p></dd><dt><span class="term">maxchild</span></dt><dd><p> 150 number of ports if hub 151 </p></dd><dt><span class="term">quirks</span></dt><dd><p> 152 quirks of the whole device 153 </p></dd><dt><span class="term">urbnum</span></dt><dd><p> 154 number of URBs submitted for the whole device 155 </p></dd><dt><span class="term">active_duration</span></dt><dd><p> 156 total time device is not suspended 157 </p></dd><dt><span class="term">connect_time</span></dt><dd><p> 158 time device was first connected 159 </p></dd><dt><span class="term">do_remote_wakeup</span></dt><dd><p> 160 remote wakeup should be enabled 161 </p></dd><dt><span class="term">reset_resume</span></dt><dd><p> 162 needs reset instead of resume 163 </p></dd><dt><span class="term">port_is_suspended</span></dt><dd><p> 164 the upstream port is suspended (L2 or U3) 165 </p></dd><dt><span class="term">wusb_dev</span></dt><dd><p> 166 if this is a Wireless USB device, link to the WUSB 167 specific data for the device. 168 </p></dd><dt><span class="term">slot_id</span></dt><dd><p> 169 Slot ID assigned by xHCI 170 </p></dd><dt><span class="term">removable</span></dt><dd><p> 171 Device can be physically removed from this port 172 </p></dd><dt><span class="term">l1_params</span></dt><dd><p> 173 best effor service latency for USB2 L1 LPM state, and L1 timeout. 174 </p></dd><dt><span class="term">u1_params</span></dt><dd><p> 175 exit latencies for USB3 U1 LPM state, and hub-initiated timeout. 176 </p></dd><dt><span class="term">u2_params</span></dt><dd><p> 177 exit latencies for USB3 U2 LPM state, and hub-initiated timeout. 178 </p></dd><dt><span class="term">lpm_disable_count</span></dt><dd><p> 179 Ref count used by <code class="function">usb_disable_lpm</code> and <code class="function">usb_enable_lpm</code> 180 to keep track of the number of functions that require USB 3.0 Link Power 181 Management to be disabled for this usb_device. This count should only 182 be manipulated by those functions, with the bandwidth_mutex is held. 183 </p></dd></dl></div></div><div class="refsect1"><a name="id-1.6.7.6"></a><h2>Notes</h2><p> 184 Usbcore drivers should not set usbdev->state directly. Instead use 185 <code class="function"><a class="link" href="API-usb-set-device-state.html" title="usb_set_device_state">usb_set_device_state</a></code>. 186</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> 187