<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="The Linux-USB Host Side API" /><link rel="up" href="ch04.html" title="Chapter 4. Host-Side Data Types and Macros" /><link rel="prev" href="re17.html" title="struct usb_host_endpoint" /><link rel="next" href="re19.html" title="struct usb_interface_cache" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>struct usb_interface</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re17.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="re19.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="struct usb_interface"><a id="API-struct-usb-interface"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct usb_interface — what usb device drivers talk to </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><pre class="programlisting"> struct usb_interface { struct usb_host_interface * altsetting; struct usb_host_interface * cur_altsetting; unsigned num_altsetting; struct usb_interface_assoc_descriptor * intf_assoc; int minor; enum usb_interface_condition condition; unsigned is_active:1; unsigned sysfs_files_created:1; unsigned ep_devs_created:1; unsigned unregistering:1; unsigned needs_remote_wakeup:1; unsigned needs_altsetting0:1; unsigned needs_binding:1; unsigned reset_running:1; struct device dev; struct device * usb_dev; atomic_t pm_usage_cnt; struct work_struct reset_ws; }; </pre></div><div class="refsect1" title="Members"><a id="id2737888"></a><h2>Members</h2><div class="variablelist"><dl><dt><span class="term">altsetting</span></dt><dd><p> array of interface structures, one for each alternate setting that may be selected. Each one includes a set of endpoint configurations. They will be in no particular order. </p></dd><dt><span class="term">cur_altsetting</span></dt><dd><p> the current altsetting. </p></dd><dt><span class="term">num_altsetting</span></dt><dd><p> number of altsettings defined. </p></dd><dt><span class="term">intf_assoc</span></dt><dd><p> interface association descriptor </p></dd><dt><span class="term">minor</span></dt><dd><p> the minor number assigned to this interface, if this interface is bound to a driver that uses the USB major number. If this interface does not use the USB major, this field should be unused. The driver should set this value in the <code class="function">probe</code> function of the driver, after it has been assigned a minor number from the USB core by calling <code class="function">usb_register_dev</code>. </p></dd><dt><span class="term">condition</span></dt><dd><p> binding state of the interface: not bound, binding (in <code class="function">probe</code>), bound to a driver, or unbinding (in <code class="function">disconnect</code>) </p></dd><dt><span class="term">is_active</span></dt><dd><p> flag set when the interface is bound and not suspended. </p></dd><dt><span class="term">sysfs_files_created</span></dt><dd><p> sysfs attributes exist </p></dd><dt><span class="term">ep_devs_created</span></dt><dd><p> endpoint child pseudo-devices exist </p></dd><dt><span class="term">unregistering</span></dt><dd><p> flag set when the interface is being unregistered </p></dd><dt><span class="term">needs_remote_wakeup</span></dt><dd><p> flag set when the driver requires remote-wakeup capability during autosuspend. </p></dd><dt><span class="term">needs_altsetting0</span></dt><dd><p> flag set when a set-interface request for altsetting 0 has been deferred. </p></dd><dt><span class="term">needs_binding</span></dt><dd><p> flag set when the driver should be re-probed or unbound following a reset or suspend operation it doesn't support. </p></dd><dt><span class="term">reset_running</span></dt><dd><p> set to 1 if the interface is currently running a queued reset so that <code class="function">usb_cancel_queued_reset</code> doesn't try to remove from the workqueue when running inside the worker thread. See <code class="function">__usb_queue_reset_device</code>. </p></dd><dt><span class="term">dev</span></dt><dd><p> driver model's view of this device </p></dd><dt><span class="term">usb_dev</span></dt><dd><p> if an interface is bound to the USB major, this will point to the sysfs representation for that device. </p></dd><dt><span class="term">pm_usage_cnt</span></dt><dd><p> PM usage counter for this interface; autosuspend is not allowed unless the counter is 0. </p></dd><dt><span class="term">reset_ws</span></dt><dd><p> Used for scheduling resets from atomic context. </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2738153"></a><h2>Description</h2><p> USB device drivers attach to interfaces on a physical device. Each interface encapsulates a single high level function, such as feeding an audio stream to a speaker or reporting a change in a volume control. Many USB devices only have one interface. The protocol used to talk to an interface's endpoints can be defined in a usb <span class="quote">“<span class="quote">class</span>”</span> specification, or by a product's vendor. The (default) control endpoint is part of every interface, but is never listed among the interface's descriptors. </p><p> The driver that is bound to the interface can use standard driver model calls such as <code class="function">dev_get_drvdata</code> on the dev member of this structure. </p><p> Each interface may have alternate settings. The initial configuration of a device sets altsetting 0, but the device driver can change that setting using <code class="function">usb_set_interface</code>. Alternate settings are often used to control the use of periodic endpoints, such as by having different endpoints use different amounts of reserved USB bandwidth. All standards-conformant USB devices that use isochronous endpoints will use them in non-default settings. </p><p> The USB specification says that alternate setting numbers must run from 0 to one less than the total number of alternate settings. But some devices manage to mess this up, and the structures aren't necessarily stored in numerical order anyhow. Use <code class="function">usb_altnum_to_altsetting</code> to look up an alternate setting in the altsetting array based on its number. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re17.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re19.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>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>struct usb_interface_cache</span></td></tr></table></div></body></html>