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 is_active:1;
17 unsigned sysfs_files_created:1;
18 unsigned ep_devs_created:1;
19 unsigned unregistering:1;
20 unsigned needs_remote_wakeup:1;
21 unsigned needs_altsetting0:1;
22 unsigned needs_binding:1;
23 unsigned reset_running: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 is_active
58 flag set when the interface is bound and not suspended.
59
60 sysfs_files_created
61 sysfs attributes exist
62
63 ep_devs_created
64 endpoint child pseudo-devices exist
65
66 unregistering
67 flag set when the interface is being unregistered
68
69 needs_remote_wakeup
70 flag set when the driver requires remote-wakeup capability during
71 autosuspend.
72
73 needs_altsetting0
74 flag set when a set-interface request for altsetting 0 has been
75 deferred.
76
77 needs_binding
78 flag set when the driver should be re-probed or unbound following a
79 reset or suspend operation it doesn´t support.
80
81 reset_running
82 set to 1 if the interface is currently running a queued reset so
83 that usb_cancel_queued_reset doesn´t try to remove from the
84 workqueue when running inside the worker thread. See
85 __usb_queue_reset_device.
86
87 dev
88 driver model´s view of this device
89
90 usb_dev
91 if an interface is bound to the USB major, this will point to the
92 sysfs representation for that device.
93
94 pm_usage_cnt
95 PM usage counter for this interface; autosuspend is not allowed
96 unless the counter is 0.
97
98 reset_ws
99 Used for scheduling resets from atomic context.
100
102 USB device drivers attach to interfaces on a physical device. Each
103 interface encapsulates a single high level function, such as feeding an
104 audio stream to a speaker or reporting a change in a volume control.
105 Many USB devices only have one interface. The protocol used to talk to
106 an interface´s endpoints can be defined in a usb “class” specification,
107 or by a product´s vendor. The (default) control endpoint is part of
108 every interface, but is never listed among the interface´s descriptors.
109
110 The driver that is bound to the interface can use standard driver model
111 calls such as dev_get_drvdata on the dev member of this structure.
112
113 Each interface may have alternate settings. The initial configuration
114 of a device sets altsetting 0, but the device driver can change that
115 setting using usb_set_interface. Alternate settings are often used to
116 control the use of periodic endpoints, such as by having different
117 endpoints use different amounts of reserved USB bandwidth. All
118 standards-conformant USB devices that use isochronous endpoints will
119 use them in non-default settings.
120
121 The USB specification says that alternate setting numbers must run from
122 0 to one less than the total number of alternate settings. But some
123 devices manage to mess this up, and the structures aren´t necessarily
124 stored in numerical order anyhow. Use usb_altnum_to_altsetting to look
125 up an alternate setting in the altsetting array based on its number.
126
128Kernel Hackers Manual 2.6. June 2019 STRUCT USB_INTERFACE(9)