1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct usb_interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux-USB Host Side API"><link rel="up" href="hostside.html" title="Chapter 4. Host-Side Data Types and Macros"><link rel="prev" href="API-struct-usb-host-endpoint.html" title="struct usb_host_endpoint"><link rel="next" href="API-struct-usb-interface-cache.html" title="struct usb_interface_cache"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct usb_interface</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-usb-host-endpoint.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Host-Side Data Types and Macros</th><td width="20%" align="right"> <a accesskey="n" href="API-struct-usb-interface-cache.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-usb-interface"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct usb_interface — 
2     what usb device drivers talk to
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct usb_interface {
5  struct usb_host_interface * altsetting;
6  struct usb_host_interface * cur_altsetting;
7  unsigned num_altsetting;
8  struct usb_interface_assoc_descriptor * intf_assoc;
9  int minor;
10  enum usb_interface_condition condition;
11  unsigned sysfs_files_created:1;
12  unsigned ep_devs_created:1;
13  unsigned unregistering:1;
14  unsigned needs_remote_wakeup:1;
15  unsigned needs_altsetting0:1;
16  unsigned needs_binding:1;
17  unsigned resetting_device:1;
18  unsigned authorized:1;
19  struct device dev;
20  struct device * usb_dev;
21  atomic_t pm_usage_cnt;
22  struct work_struct reset_ws;
23};  </pre></div><div class="refsect1"><a name="id-1.6.4.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">altsetting</span></dt><dd><p>
24   array of interface structures, one for each alternate
25   setting that may be selected.  Each one includes a set of
26   endpoint configurations.  They will be in no particular order.
27      </p></dd><dt><span class="term">cur_altsetting</span></dt><dd><p>
28   the current altsetting.
29      </p></dd><dt><span class="term">num_altsetting</span></dt><dd><p>
30   number of altsettings defined.
31      </p></dd><dt><span class="term">intf_assoc</span></dt><dd><p>
32   interface association descriptor
33      </p></dd><dt><span class="term">minor</span></dt><dd><p>
34   the minor number assigned to this interface, if this
35   interface is bound to a driver that uses the USB major number.
36   If this interface does not use the USB major, this field should
37   be unused.  The driver should set this value in the <code class="function">probe</code>
38   function of the driver, after it has been assigned a minor
39   number from the USB core by calling <code class="function"><a class="link" href="API-usb-register-dev.html" title="usb_register_dev">usb_register_dev</a></code>.
40      </p></dd><dt><span class="term">condition</span></dt><dd><p>
41   binding state of the interface: not bound, binding
42   (in <code class="function">probe</code>), bound to a driver, or unbinding (in <code class="function">disconnect</code>)
43      </p></dd><dt><span class="term">sysfs_files_created</span></dt><dd><p>
44   sysfs attributes exist
45      </p></dd><dt><span class="term">ep_devs_created</span></dt><dd><p>
46   endpoint child pseudo-devices exist
47      </p></dd><dt><span class="term">unregistering</span></dt><dd><p>
48   flag set when the interface is being unregistered
49      </p></dd><dt><span class="term">needs_remote_wakeup</span></dt><dd><p>
50   flag set when the driver requires remote-wakeup
51   capability during autosuspend.
52      </p></dd><dt><span class="term">needs_altsetting0</span></dt><dd><p>
53   flag set when a set-interface request for altsetting 0
54   has been deferred.
55      </p></dd><dt><span class="term">needs_binding</span></dt><dd><p>
56   flag set when the driver should be re-probed or unbound
57   following a reset or suspend operation it doesn't support.
58      </p></dd><dt><span class="term">resetting_device</span></dt><dd><p>
59   USB core reset the device, so use alt setting 0 as
60   current; needs bandwidth alloc after reset.
61      </p></dd><dt><span class="term">authorized</span></dt><dd><p>
62   This allows to (de)authorize individual interfaces instead
63   a whole device in contrast to the device authorization.
64      </p></dd><dt><span class="term">dev</span></dt><dd><p>
65   driver model's view of this device
66      </p></dd><dt><span class="term">usb_dev</span></dt><dd><p>
67   if an interface is bound to the USB major, this will point
68   to the sysfs representation for that device.
69      </p></dd><dt><span class="term">pm_usage_cnt</span></dt><dd><p>
70   PM usage counter for this interface
71      </p></dd><dt><span class="term">reset_ws</span></dt><dd><p>
72   Used for scheduling resets from atomic context.
73      </p></dd></dl></div></div><div class="refsect1"><a name="id-1.6.4.6"></a><h2>Description</h2><p>
74   USB device drivers attach to interfaces on a physical device.  Each
75   interface encapsulates a single high level function, such as feeding
76   an audio stream to a speaker or reporting a change in a volume control.
77   Many USB devices only have one interface.  The protocol used to talk to
78   an interface's endpoints can be defined in a usb <span class="quote">“<span class="quote">class</span>”</span> specification,
79   or by a product's vendor.  The (default) control endpoint is part of
80   every interface, but is never listed among the interface's descriptors.
81   </p><p>
82
83   The driver that is bound to the interface can use standard driver model
84   calls such as <code class="function">dev_get_drvdata</code> on the dev member of this structure.
85   </p><p>
86
87   Each interface may have alternate settings.  The initial configuration
88   of a device sets altsetting 0, but the device driver can change
89   that setting using <code class="function"><a class="link" href="API-usb-set-interface.html" title="usb_set_interface">usb_set_interface</a></code>.  Alternate settings are often
90   used to control the use of periodic endpoints, such as by having
91   different endpoints use different amounts of reserved USB bandwidth.
92   All standards-conformant USB devices that use isochronous endpoints
93   will use them in non-default settings.
94   </p><p>
95
96   The USB specification says that alternate setting numbers must run from
97   0 to one less than the total number of alternate settings.  But some
98   devices manage to mess this up, and the structures aren't necessarily
99   stored in numerical order anyhow.  Use <code class="function"><a class="link" href="API-usb-altnum-to-altsetting.html" title="usb_altnum_to_altsetting">usb_altnum_to_altsetting</a></code> to
100   look up an alternate setting in the altsetting array based on its number.
101</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-usb-host-endpoint.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="hostside.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-struct-usb-interface-cache.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct usb_host_endpoint</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">struct usb_interface_cache</span></td></tr></table></div></body></html>
102