1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>usb_interface_id</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-function-activate.html" title="usb_function_activate"><link rel="next" href="API-usb-add-config.html" title="usb_add_config"></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_interface_id</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-usb-function-activate.html">Prev</a> </td><th width="60%" align="center">Composite Device Framework</th><td width="20%" align="right"> <a accesskey="n" href="API-usb-add-config.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-usb-interface-id"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>usb_interface_id — 2 allocate an unused interface ID 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_interface_id </b>(</code></td><td>struct usb_configuration * <var class="pdparam">config</var>, </td></tr><tr><td> </td><td>struct usb_function * <var class="pdparam">function</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1124430596"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>config</code></em></span></dt><dd><p> 4 configuration associated with the interface 5 </p></dd><dt><span class="term"><em class="parameter"><code>function</code></em></span></dt><dd><p> 6 function handling the interface 7 </p></dd></dl></div></div><div class="refsect1"><a name="idp1124433188"></a><h2>Context</h2><p> 8 single threaded during gadget setup 9</p></div><div class="refsect1"><a name="idp1124433812"></a><h2>Description</h2><p> 10 <code class="function">usb_interface_id</code> is called from usb_function.<code class="function">bind</code> callbacks to 11 allocate new interface IDs. The function driver will then store that 12 ID in interface, association, CDC union, and other descriptors. It 13 will also handle any control requests targeted at that interface, 14 particularly changing its altsetting via <code class="function">set_alt</code>. There may 15 also be class-specific or vendor-specific requests to handle. 16 </p><p> 17 18 All interface identifier should be allocated using this routine, to 19 ensure that for example different functions don't wrongly assign 20 different meanings to the same identifier. Note that since interface 21 identifiers are configuration-specific, functions used in more than 22 one configuration (or more than once in a given configuration) need 23 multiple versions of the relevant descriptors. 24 </p><p> 25 26 Returns the interface ID which was allocated; or -ENODEV if no 27 more interface IDs can be allocated. 28</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-function-activate.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-add-config.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">usb_function_activate</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_add_config</span></td></tr></table></div></body></html> 29