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