1STRUCT USB_DEVICE(9) Host-Side Data Types and Macro STRUCT USB_DEVICE(9)
2
3
4
6 struct_usb_device - kernel's representation of a USB device
7
9 struct usb_device {
10 int devnum;
11 char devpath[16];
12 u32 route;
13 enum usb_device_state state;
14 enum usb_device_speed speed;
15 struct usb_tt * tt;
16 int ttport;
17 unsigned int toggle[2];
18 struct usb_device * parent;
19 struct usb_bus * bus;
20 struct usb_host_endpoint ep0;
21 struct device dev;
22 struct usb_device_descriptor descriptor;
23 struct usb_host_bos * bos;
24 struct usb_host_config * config;
25 struct usb_host_config * actconfig;
26 struct usb_host_endpoint * ep_in[16];
27 struct usb_host_endpoint * ep_out[16];
28 char ** rawdescriptors;
29 unsigned short bus_mA;
30 u8 portnum;
31 u8 level;
32 unsigned can_submit:1;
33 unsigned persist_enabled:1;
34 unsigned have_langid:1;
35 unsigned authorized:1;
36 unsigned authenticated:1;
37 unsigned wusb:1;
38 unsigned lpm_capable:1;
39 unsigned usb2_hw_lpm_capable:1;
40 unsigned usb2_hw_lpm_besl_capable:1;
41 unsigned usb2_hw_lpm_enabled:1;
42 unsigned usb2_hw_lpm_allowed:1;
43 unsigned usb3_lpm_u1_enabled:1;
44 unsigned usb3_lpm_u2_enabled:1;
45 int string_langid;
46 char * product;
47 char * manufacturer;
48 char * serial;
49 struct list_head filelist;
50 int maxchild;
51 u32 quirks;
52 atomic_t urbnum;
53 unsigned long active_duration;
54 #ifdef CONFIG_PM
55 unsigned long connect_time;
56 unsigned do_remote_wakeup:1;
57 unsigned reset_resume:1;
58 unsigned port_is_suspended:1;
59 #endif
60 struct wusb_dev * wusb_dev;
61 int slot_id;
62 enum usb_device_removable removable;
63 struct usb2_lpm_parameters l1_params;
64 struct usb3_lpm_parameters u1_params;
65 struct usb3_lpm_parameters u2_params;
66 unsigned lpm_disable_count;
67 u16 hub_delay;
68 };
69
71 devnum
72 device number; address on a USB bus
73
74 devpath[16]
75 device ID string for use in messages (e.g., /port/...)
76
77 route
78 tree topology hex string for use with xHCI
79
80 state
81 device state: configured, not attached, etc.
82
83 speed
84 device speed: high/full/low (or error)
85
86 tt
87 Transaction Translator info; used with low/full speed dev,
88 highspeed hub
89
90 ttport
91 device port on that tt hub
92
93 toggle[2]
94 one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
95
96 parent
97 our hub, unless we're the root
98
99 bus
100 bus we're part of
101
102 ep0
103 endpoint 0 data (default control pipe)
104
105 dev
106 generic device interface
107
108 descriptor
109 USB device descriptor
110
111 bos
112 USB device BOS descriptor set
113
114 config
115 all of the device's configs
116
117 actconfig
118 the active configuration
119
120 ep_in[16]
121 array of IN endpoints
122
123 ep_out[16]
124 array of OUT endpoints
125
126 rawdescriptors
127 raw descriptors for each config
128
129 bus_mA
130 Current available from the bus
131
132 portnum
133 parent port number (origin 1)
134
135 level
136 number of USB hub ancestors
137
138 can_submit
139 URBs may be submitted
140
141 persist_enabled
142 USB_PERSIST enabled for this device
143
144 have_langid
145 whether string_langid is valid
146
147 authorized
148 policy has said we can use it; (user space) policy determines if we
149 authorize this device to be used or not. By default, wired USB
150 devices are authorized. WUSB devices are not, until we authorize
151 them from user space. FIXME -- complete doc
152
153 authenticated
154 Crypto authentication passed
155
156 wusb
157 device is Wireless USB
158
159 lpm_capable
160 device supports LPM
161
162 usb2_hw_lpm_capable
163 device can perform USB2 hardware LPM
164
165 usb2_hw_lpm_besl_capable
166 device can perform USB2 hardware BESL LPM
167
168 usb2_hw_lpm_enabled
169 USB2 hardware LPM is enabled
170
171 usb2_hw_lpm_allowed
172 Userspace allows USB 2.0 LPM to be enabled
173
174 usb3_lpm_u1_enabled
175 USB3 hardware U1 LPM enabled
176
177 usb3_lpm_u2_enabled
178 USB3 hardware U2 LPM enabled
179
180 string_langid
181 language ID for strings
182
183 product
184 iProduct string, if present (static)
185
186 manufacturer
187 iManufacturer string, if present (static)
188
189 serial
190 iSerialNumber string, if present (static)
191
192 filelist
193 usbfs files that are open to this device
194
195 maxchild
196 number of ports if hub
197
198 quirks
199 quirks of the whole device
200
201 urbnum
202 number of URBs submitted for the whole device
203
204 active_duration
205 total time device is not suspended
206
207 connect_time
208 time device was first connected
209
210 do_remote_wakeup
211 remote wakeup should be enabled
212
213 reset_resume
214 needs reset instead of resume
215
216 port_is_suspended
217 the upstream port is suspended (L2 or U3)
218
219 wusb_dev
220 if this is a Wireless USB device, link to the WUSB specific data
221 for the device.
222
223 slot_id
224 Slot ID assigned by xHCI
225
226 removable
227 Device can be physically removed from this port
228
229 l1_params
230 best effor service latency for USB2 L1 LPM state, and L1 timeout.
231
232 u1_params
233 exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
234
235 u2_params
236 exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
237
238 lpm_disable_count
239 Ref count used by usb_disable_lpm and usb_enable_lpm to keep track
240 of the number of functions that require USB 3.0 Link Power
241 Management to be disabled for this usb_device. This count should
242 only be manipulated by those functions, with the bandwidth_mutex is
243 held.
244
245 hub_delay
246 cached value consisting of: parent->hub_delay + wHubDelay +
247 tTPTransmissionDelay (40ns)
248
250 Will be used as wValue for SetIsochDelay requests.
251
253 Usbcore drivers should not set usbdev->state directly. Instead use
254 usb_set_device_state.
255
257Kernel Hackers Manual 3.10 June 2019 STRUCT USB_DEVICE(9)