1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct usb_host_config</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&#160;4.&#160;Host-Side Data Types and Macros"><link rel="prev" href="API-struct-usb-interface-cache.html" title="struct usb_interface_cache"><link rel="next" href="API-struct-usb-device.html" title="struct usb_device"></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_host_config</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-usb-interface-cache.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;4.&#160;Host-Side Data Types and Macros</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-struct-usb-device.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-usb-host-config"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct usb_host_config &#8212; 
2     representation of a device's configuration
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct usb_host_config {
5  struct usb_config_descriptor desc;
6  char * string;
7  struct usb_interface_assoc_descriptor * intf_assoc[USB_MAXIADS];
8  struct usb_interface * interface[USB_MAXINTERFACES];
9  struct usb_interface_cache * intf_cache[USB_MAXINTERFACES];
10  unsigned char * extra;
11  int extralen;
12};  </pre></div><div class="refsect1"><a name="idp1115581612"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">desc</span></dt><dd><p>
13   the device's configuration descriptor.
14      </p></dd><dt><span class="term">string</span></dt><dd><p>
15   pointer to the cached version of the iConfiguration string, if
16   present for this configuration.
17      </p></dd><dt><span class="term">intf_assoc[USB_MAXIADS]</span></dt><dd><p>
18   list of any interface association descriptors in this config
19      </p></dd><dt><span class="term">interface[USB_MAXINTERFACES]</span></dt><dd><p>
20   array of pointers to usb_interface structures, one for each
21   interface in the configuration.  The number of interfaces is stored
22   in desc.bNumInterfaces.  These pointers are valid only while the
23   the configuration is active.
24      </p></dd><dt><span class="term">intf_cache[USB_MAXINTERFACES]</span></dt><dd><p>
25   array of pointers to usb_interface_cache structures, one
26   for each interface in the configuration.  These structures exist
27   for the entire life of the device.
28      </p></dd><dt><span class="term">extra</span></dt><dd><p>
29   pointer to buffer containing all extra descriptors associated
30   with this configuration (those preceding the first interface
31   descriptor).
32      </p></dd><dt><span class="term">extralen</span></dt><dd><p>
33   length of the extra descriptors buffer.
34      </p></dd></dl></div></div><div class="refsect1"><a name="idp1115587572"></a><h2>Description</h2><p>
35   USB devices may have multiple configurations, but only one can be active
36   at any time.  Each encapsulates a different operational environment;
37   for example, a dual-speed device would have separate configurations for
38   full-speed and high-speed operation.  The number of configurations
39   available is stored in the device descriptor as bNumConfigurations.
40   </p><p>
41
42   A configuration can contain multiple interfaces.  Each corresponds to
43   a different function of the USB device, and all are available whenever
44   the configuration is active.  The USB standard says that interfaces
45   are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
46   of devices get this wrong.  In addition, the interface array is not
47   guaranteed to be sorted in numerical order.  Use <code class="function">usb_ifnum_to_if</code> to
48   look up an interface entry based on its number.
49   </p><p>
50
51   Device drivers should not attempt to activate configurations.  The choice
52   of which configuration to install is a policy decision based on such
53   considerations as available power, functionality provided, and the user's
54   desires (expressed through userspace tools).  However, drivers can call
55   <code class="function">usb_reset_configuration</code> to reinitialize the current configuration and
56   all its interfaces.
57</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-interface-cache.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="hostside.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-struct-usb-device.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct usb_interface_cache</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">struct usb_device</span></td></tr></table></div></body></html>
58