1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>usb_add_config</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="USB Gadget API for Linux"><link rel="up" href="composite.html" title="Composite Device Framework"><link rel="prev" href="API-usb-interface-id.html" title="usb_interface_id"><link rel="next" href="API-usb-string-id.html" title="usb_string_id"></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">usb_add_config</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-usb-interface-id.html">Prev</a> </td><th width="60%" align="center">Composite Device Framework</th><td width="20%" align="right"> <a accesskey="n" href="API-usb-string-id.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-usb-add-config"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>usb_add_config — 2 add a configuration to a device. 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">usb_add_config </b>(</code></td><td>struct usb_composite_dev * <var class="pdparam">cdev</var>, </td></tr><tr><td> </td><td>struct usb_configuration * <var class="pdparam">config</var>, </td></tr><tr><td> </td><td>int (*<var class="pdparam">bind</var>) 4 <code>(</code>struct usb_configuration *<code>)</code><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1124441892"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>cdev</code></em></span></dt><dd><p> 5 wraps the USB gadget 6 </p></dd><dt><span class="term"><em class="parameter"><code>config</code></em></span></dt><dd><p> 7 the configuration, with bConfigurationValue assigned 8 </p></dd><dt><span class="term"><em class="parameter"><code>bind</code></em></span></dt><dd><p> 9 the configuration's bind function 10 </p></dd></dl></div></div><div class="refsect1"><a name="idp1124445492"></a><h2>Context</h2><p> 11 single threaded during gadget setup 12</p></div><div class="refsect1"><a name="idp1124446116"></a><h2>Description</h2><p> 13 One of the main tasks of a composite <em class="parameter"><code>bind</code></em>() routine is to 14 add each of the configurations it supports, using this routine. 15 </p><p> 16 17 This function returns the value of the configuration's <em class="parameter"><code>bind</code></em>(), which 18 is zero for success else a negative errno value. Binding configurations 19 assigns global resources including string IDs, and per-configuration 20 resources such as interface IDs and endpoints. 21</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-usb-interface-id.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="composite.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-usb-string-id.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">usb_interface_id</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">usb_string_id</span></td></tr></table></div></body></html> 22