1STRUCT USB_DEVICE(9)    Host-Side Data Types and Macro    STRUCT USB_DEVICE(9)
2
3
4

NAME

6       struct_usb_device - kernel´s representation of a USB device
7

SYNOPSIS

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_config * config;
24         struct usb_host_config * actconfig;
25         struct usb_host_endpoint * ep_in[16];
26         struct usb_host_endpoint * ep_out[16];
27         char ** rawdescriptors;
28         unsigned short bus_mA;
29         u8 portnum;
30         u8 level;
31         unsigned can_submit:1;
32         unsigned discon_suspended:1;
33         unsigned persist_enabled:1;
34         unsigned have_langid:1;
35         unsigned authorized:1;
36         unsigned authenticated:1;
37         unsigned wusb:1;
38       #ifndef __GENKSYMS__
39         unsigned lpm_capable:1;
40         unsigned usb2_hw_lpm_capable:1;
41         unsigned usb2_hw_lpm_enabled:1;
42         unsigned usb2_hw_lpm_allowed:1;
43         unsigned usb2_hw_lpm_besl_capable:1;
44       #endif
45         int string_langid;
46         char * product;
47         char * manufacturer;
48         char * serial;
49         struct list_head filelist;
50       #ifdef CONFIG_USB_DEVICE_CLASS
51         struct device * usb_classdev;
52       #endif
53       #ifdef CONFIG_USB_DEVICEFS
54         struct dentry * usbfs_dentry;
55       #endif
56         int maxchild;
57         struct usb_device * children[USB_MAXCHILDREN];
58         int pm_usage_cnt;
59         u32 quirks;
60         atomic_t urbnum;
61         unsigned long active_duration;
62       #ifdef CONFIG_PM
63         struct delayed_work autosuspend;
64         struct work_struct autoresume;
65         struct mutex pm_mutex;
66         unsigned long last_busy;
67         int autosuspend_delay;
68         unsigned long connect_time;
69         unsigned auto_pm:1;
70         unsigned do_remote_wakeup:1;
71         unsigned reset_resume:1;
72         unsigned autosuspend_disabled:1;
73         unsigned autoresume_disabled:1;
74         unsigned skip_sys_resume:1;
75       #endif
76         struct wusb_dev * wusb_dev;
77         int slot_id;
78       #ifndef __GENKSYMS__
79         struct usb_host_bos * bos;
80         struct usb3_lpm_parameters u1_params;
81         struct usb3_lpm_parameters u2_params;
82         unsigned lpm_disable_count;
83       #endif
84       };
85

MEMBERS

87       devnum
88           device number; address on a USB bus
89
90       devpath[16]
91           device ID string for use in messages (e.g., /port/...)
92
93       route
94           tree topology hex string for use with xHCI
95
96       state
97           device state: configured, not attached, etc.
98
99       speed
100           device speed: high/full/low (or error)
101
102       tt
103           Transaction Translator info; used with low/full speed dev,
104           highspeed hub
105
106       ttport
107           device port on that tt hub
108
109       toggle[2]
110           one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
111
112       parent
113           our hub, unless we´re the root
114
115       bus
116           bus we´re part of
117
118       ep0
119           endpoint 0 data (default control pipe)
120
121       dev
122           generic device interface
123
124       descriptor
125           USB device descriptor
126
127       config
128           all of the device´s configs
129
130       actconfig
131           the active configuration
132
133       ep_in[16]
134           array of IN endpoints
135
136       ep_out[16]
137           array of OUT endpoints
138
139       rawdescriptors
140           raw descriptors for each config
141
142       bus_mA
143           Current available from the bus
144
145       portnum
146           parent port number (origin 1)
147
148       level
149           number of USB hub ancestors
150
151       can_submit
152           URBs may be submitted
153
154       discon_suspended
155           disconnected while suspended
156
157       persist_enabled
158           USB_PERSIST enabled for this device
159
160       have_langid
161           whether string_langid is valid
162
163       authorized
164           policy has said we can use it; (user space) policy determines if we
165           authorize this device to be used or not. By default, wired USB
166           devices are authorized. WUSB devices are not, until we authorize
167           them from user space. FIXME -- complete doc
168
169       authenticated
170           Crypto authentication passed
171
172       wusb
173           device is Wireless USB
174
175       lpm_capable
176           device supports LPM
177
178       usb2_hw_lpm_capable
179           device can perform USB2 hardware LPM
180
181       usb2_hw_lpm_enabled
182           USB2 hardware LPM is enabled
183
184       usb2_hw_lpm_allowed
185           Userspace allows USB 2.0 LPM to be enabled
186
187       usb2_hw_lpm_besl_capable
188           device can perform USB2 hardware BESL LPM
189
190       string_langid
191           language ID for strings
192
193       product
194           iProduct string, if present (static)
195
196       manufacturer
197           iManufacturer string, if present (static)
198
199       serial
200           iSerialNumber string, if present (static)
201
202       filelist
203           usbfs files that are open to this device
204
205       usb_classdev
206           USB class device that was created for usbfs device access from
207           userspace
208
209       usbfs_dentry
210           usbfs dentry entry for the device
211
212       maxchild
213           number of ports if hub
214
215       children[USB_MAXCHILDREN]
216           child devices - USB devices that are attached to this hub
217
218       pm_usage_cnt
219           usage counter for autosuspend
220
221       quirks
222           quirks of the whole device
223
224       urbnum
225           number of URBs submitted for the whole device
226
227       active_duration
228           total time device is not suspended
229
230       autosuspend
231           for delayed autosuspends
232
233       autoresume
234           for autoresumes requested while in_interrupt
235
236       pm_mutex
237           protects PM operations
238
239       last_busy
240           time of last use
241
242       autosuspend_delay
243           in jiffies
244
245       connect_time
246           time device was first connected
247
248       auto_pm
249           autosuspend/resume in progress
250
251       do_remote_wakeup
252           remote wakeup should be enabled
253
254       reset_resume
255           needs reset instead of resume
256
257       autosuspend_disabled
258           autosuspend disabled by the user
259
260       autoresume_disabled
261           autoresume disabled by the user
262
263       skip_sys_resume
264           skip the next system resume
265
266       wusb_dev
267           if this is a Wireless USB device, link to the WUSB specific data
268           for the device.
269
270       slot_id
271           Slot ID assigned by xHCI
272
273       bos
274           USB device BOS descriptor set
275
276       u1_params
277           exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
278
279       u2_params
280           exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
281
282       lpm_disable_count
283           Ref count used by usb_disable_lpm and usb_enable_lpm to keep track
284           of the number of functions that require USB 3.0 Link Power
285           Management to be disabled for this usb_device. This count should
286           only be manipulated by those functions, with the bandwidth_mutex is
287           held.
288

NOTES

290       Usbcore drivers should not set usbdev->state directly. Instead use
291       usb_set_device_state.
292
294Kernel Hackers Manual 2.6.         June 2019              STRUCT USB_DEVICE(9)
Impressum