1STRUCT USB_INTERFACE(9) Host-Side Data Types and Macro STRUCT USB_INTERFACE(9)
2
3
4
6 struct_usb_interface - what usb device drivers talk to
7
9 struct usb_interface {
10 struct usb_host_interface * altsetting;
11 struct usb_host_interface * cur_altsetting;
12 unsigned num_altsetting;
13 struct usb_interface_assoc_descriptor * intf_assoc;
14 int minor;
15 enum usb_interface_condition condition;
16 unsigned sysfs_files_created:1;
17 unsigned ep_devs_created:1;
18 unsigned unregistering:1;
19 unsigned needs_remote_wakeup:1;
20 unsigned needs_altsetting0:1;
21 unsigned needs_binding:1;
22 unsigned reset_running:1;
23 struct device dev;
24 struct device * usb_dev;
25 atomic_t pm_usage_cnt;
26 struct work_struct reset_ws;
27 };
28
30 altsetting
31 array of interface structures, one for each alternate setting that
32 may be selected. Each one includes a set of endpoint
33 configurations. They will be in no particular order.
34
35 cur_altsetting
36 the current altsetting.
37
38 num_altsetting
39 number of altsettings defined.
40
41 intf_assoc
42 interface association descriptor
43
44 minor
45 the minor number assigned to this interface, if this interface is
46 bound to a driver that uses the USB major number. If this interface
47 does not use the USB major, this field should be unused. The driver
48 should set this value in the probe function of the driver, after it
49 has been assigned a minor number from the USB core by calling
50 usb_register_dev.
51
52 condition
53 binding state of the interface: not bound, binding (in probe),
54 bound to a driver, or unbinding (in disconnect)
55
56 sysfs_files_created
57 sysfs attributes exist
58
59 ep_devs_created
60 endpoint child pseudo-devices exist
61
62 unregistering
63 flag set when the interface is being unregistered
64
65 needs_remote_wakeup
66 flag set when the driver requires remote-wakeup capability during
67 autosuspend.
68
69 needs_altsetting0
70 flag set when a set-interface request for altsetting 0 has been
71 deferred.
72
73 needs_binding
74 flag set when the driver should be re-probed or unbound following a
75 reset or suspend operation it doesn't support.
76
77 reset_running
78 set to 1 if the interface is currently running a queued reset so
79 that usb_cancel_queued_reset doesn't try to remove from the
80 workqueue when running inside the worker thread. See
81 __usb_queue_reset_device.
82
83 dev
84 driver model's view of this device
85
86 usb_dev
87 if an interface is bound to the USB major, this will point to the
88 sysfs representation for that device.
89
90 pm_usage_cnt
91 PM usage counter for this interface
92
93 reset_ws
94 Used for scheduling resets from atomic context.
95
97 USB device drivers attach to interfaces on a physical device. Each
98 interface encapsulates a single high level function, such as feeding an
99 audio stream to a speaker or reporting a change in a volume control.
100 Many USB devices only have one interface. The protocol used to talk to
101 an interface's endpoints can be defined in a usb “class” specification,
102 or by a product's vendor. The (default) control endpoint is part of
103 every interface, but is never listed among the interface's descriptors.
104
105 The driver that is bound to the interface can use standard driver model
106 calls such as dev_get_drvdata on the dev member of this structure.
107
108 Each interface may have alternate settings. The initial configuration
109 of a device sets altsetting 0, but the device driver can change that
110 setting using usb_set_interface. Alternate settings are often used to
111 control the use of periodic endpoints, such as by having different
112 endpoints use different amounts of reserved USB bandwidth. All
113 standards-conformant USB devices that use isochronous endpoints will
114 use them in non-default settings.
115
116 The USB specification says that alternate setting numbers must run from
117 0 to one less than the total number of alternate settings. But some
118 devices manage to mess this up, and the structures aren't necessarily
119 stored in numerical order anyhow. Use usb_altnum_to_altsetting to look
120 up an alternate setting in the altsetting array based on its number.
121
123Kernel Hackers Manual 2.6. November 2011 STRUCT USB_INTERFACE(9)