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_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 persist_enabled:1;
33 unsigned have_langid:1;
34 unsigned authorized:1;
35 unsigned authenticated:1;
36 unsigned wusb:1;
37 int string_langid;
38 char * product;
39 char * manufacturer;
40 char * serial;
41 struct list_head filelist;
42 #ifdef CONFIG_USB_DEVICE_CLASS
43 struct device * usb_classdev;
44 #endif
45 #ifdef CONFIG_USB_DEVICEFS
46 struct dentry * usbfs_dentry;
47 #endif
48 int maxchild;
49 struct usb_device * children[USB_MAXCHILDREN];
50 u32 quirks;
51 atomic_t urbnum;
52 unsigned long active_duration;
53 #ifdef CONFIG_PM
54 unsigned long last_busy;
55 int autosuspend_delay;
56 unsigned long connect_time;
57 unsigned do_remote_wakeup:1;
58 unsigned reset_resume:1;
59 #endif
60 struct wusb_dev * wusb_dev;
61 int slot_id;
62 };
63
65 devnum
66 device number; address on a USB bus
67
68 devpath[16]
69 device ID string for use in messages (e.g., /port/...)
70
71 route
72 tree topology hex string for use with xHCI
73
74 state
75 device state: configured, not attached, etc.
76
77 speed
78 device speed: high/full/low (or error)
79
80 tt
81 Transaction Translator info; used with low/full speed dev,
82 highspeed hub
83
84 ttport
85 device port on that tt hub
86
87 toggle[2]
88 one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints
89
90 parent
91 our hub, unless we're the root
92
93 bus
94 bus we're part of
95
96 ep0
97 endpoint 0 data (default control pipe)
98
99 dev
100 generic device interface
101
102 descriptor
103 USB device descriptor
104
105 config
106 all of the device's configs
107
108 actconfig
109 the active configuration
110
111 ep_in[16]
112 array of IN endpoints
113
114 ep_out[16]
115 array of OUT endpoints
116
117 rawdescriptors
118 raw descriptors for each config
119
120 bus_mA
121 Current available from the bus
122
123 portnum
124 parent port number (origin 1)
125
126 level
127 number of USB hub ancestors
128
129 can_submit
130 URBs may be submitted
131
132 persist_enabled
133 USB_PERSIST enabled for this device
134
135 have_langid
136 whether string_langid is valid
137
138 authorized
139 policy has said we can use it; (user space) policy determines if we
140 authorize this device to be used or not. By default, wired USB
141 devices are authorized. WUSB devices are not, until we authorize
142 them from user space. FIXME -- complete doc
143
144 authenticated
145 Crypto authentication passed
146
147 wusb
148 device is Wireless USB
149
150 string_langid
151 language ID for strings
152
153 product
154 iProduct string, if present (static)
155
156 manufacturer
157 iManufacturer string, if present (static)
158
159 serial
160 iSerialNumber string, if present (static)
161
162 filelist
163 usbfs files that are open to this device
164
165 usb_classdev
166 USB class device that was created for usbfs device access from
167 userspace
168
169 usbfs_dentry
170 usbfs dentry entry for the device
171
172 maxchild
173 number of ports if hub
174
175 children[USB_MAXCHILDREN]
176 child devices - USB devices that are attached to this hub
177
178 quirks
179 quirks of the whole device
180
181 urbnum
182 number of URBs submitted for the whole device
183
184 active_duration
185 total time device is not suspended
186
187 last_busy
188 time of last use
189
190 autosuspend_delay
191 in jiffies
192
193 connect_time
194 time device was first connected
195
196 do_remote_wakeup
197 remote wakeup should be enabled
198
199 reset_resume
200 needs reset instead of resume
201
202 wusb_dev
203 if this is a Wireless USB device, link to the WUSB specific data
204 for the device.
205
206 slot_id
207 Slot ID assigned by xHCI
208
210 Usbcore drivers should not set usbdev->state directly. Instead use
211 usb_set_device_state.
212
214Kernel Hackers Manual 2.6. November 2011 STRUCT USB_DEVICE(9)