1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><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 struct device dev; 19 struct device * usb_dev; 20 atomic_t pm_usage_cnt; 21 struct work_struct reset_ws; 22}; </pre></div><div class="refsect1"><a name="idp1112653812"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">altsetting</span></dt><dd><p> 23 array of interface structures, one for each alternate 24 setting that may be selected. Each one includes a set of 25 endpoint configurations. They will be in no particular order. 26 </p></dd><dt><span class="term">cur_altsetting</span></dt><dd><p> 27 the current altsetting. 28 </p></dd><dt><span class="term">num_altsetting</span></dt><dd><p> 29 number of altsettings defined. 30 </p></dd><dt><span class="term">intf_assoc</span></dt><dd><p> 31 interface association descriptor 32 </p></dd><dt><span class="term">minor</span></dt><dd><p> 33 the minor number assigned to this interface, if this 34 interface is bound to a driver that uses the USB major number. 35 If this interface does not use the USB major, this field should 36 be unused. The driver should set this value in the <code class="function">probe</code> 37 function of the driver, after it has been assigned a minor 38 number from the USB core by calling <code class="function">usb_register_dev</code>. 39 </p></dd><dt><span class="term">condition</span></dt><dd><p> 40 binding state of the interface: not bound, binding 41 (in <code class="function">probe</code>), bound to a driver, or unbinding (in <code class="function">disconnect</code>) 42 </p></dd><dt><span class="term">sysfs_files_created</span></dt><dd><p> 43 sysfs attributes exist 44 </p></dd><dt><span class="term">ep_devs_created</span></dt><dd><p> 45 endpoint child pseudo-devices exist 46 </p></dd><dt><span class="term">unregistering</span></dt><dd><p> 47 flag set when the interface is being unregistered 48 </p></dd><dt><span class="term">needs_remote_wakeup</span></dt><dd><p> 49 flag set when the driver requires remote-wakeup 50 capability during autosuspend. 51 </p></dd><dt><span class="term">needs_altsetting0</span></dt><dd><p> 52 flag set when a set-interface request for altsetting 0 53 has been deferred. 54 </p></dd><dt><span class="term">needs_binding</span></dt><dd><p> 55 flag set when the driver should be re-probed or unbound 56 following a reset or suspend operation it doesn't support. 57 </p></dd><dt><span class="term">resetting_device</span></dt><dd><p> 58 USB core reset the device, so use alt setting 0 as 59 current; needs bandwidth alloc after reset. 60 </p></dd><dt><span class="term">dev</span></dt><dd><p> 61 driver model's view of this device 62 </p></dd><dt><span class="term">usb_dev</span></dt><dd><p> 63 if an interface is bound to the USB major, this will point 64 to the sysfs representation for that device. 65 </p></dd><dt><span class="term">pm_usage_cnt</span></dt><dd><p> 66 PM usage counter for this interface 67 </p></dd><dt><span class="term">reset_ws</span></dt><dd><p> 68 Used for scheduling resets from atomic context. 69 </p></dd></dl></div></div><div class="refsect1"><a name="idp1112668732"></a><h2>Description</h2><p> 70 USB device drivers attach to interfaces on a physical device. Each 71 interface encapsulates a single high level function, such as feeding 72 an audio stream to a speaker or reporting a change in a volume control. 73 Many USB devices only have one interface. The protocol used to talk to 74 an interface's endpoints can be defined in a usb <span class="quote">“<span class="quote">class</span>”</span> specification, 75 or by a product's vendor. The (default) control endpoint is part of 76 every interface, but is never listed among the interface's descriptors. 77 </p><p> 78 79 The driver that is bound to the interface can use standard driver model 80 calls such as <code class="function">dev_get_drvdata</code> on the dev member of this structure. 81 </p><p> 82 83 Each interface may have alternate settings. The initial configuration 84 of a device sets altsetting 0, but the device driver can change 85 that setting using <code class="function">usb_set_interface</code>. Alternate settings are often 86 used to control the use of periodic endpoints, such as by having 87 different endpoints use different amounts of reserved USB bandwidth. 88 All standards-conformant USB devices that use isochronous endpoints 89 will use them in non-default settings. 90 </p><p> 91 92 The USB specification says that alternate setting numbers must run from 93 0 to one less than the total number of alternate settings. But some 94 devices manage to mess this up, and the structures aren't necessarily 95 stored in numerical order anyhow. Use <code class="function">usb_altnum_to_altsetting</code> to 96 look up an alternate setting in the altsetting array based on its number. 97</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> 98