1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>usb_ifnum_to_if</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="usbcore.html" title="Chapter&#160;5.&#160;USB Core APIs"><link rel="prev" href="API-usb-find-alt-setting.html" title="usb_find_alt_setting"><link rel="next" href="API-usb-altnum-to-altsetting.html" title="usb_altnum_to_altsetting"></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_ifnum_to_if</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-usb-find-alt-setting.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;5.&#160;USB Core APIs</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-usb-altnum-to-altsetting.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-usb-ifnum-to-if"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>usb_ifnum_to_if &#8212; 
2     get the interface object with a given interface number
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">struct usb_interface * <b class="fsfunc">usb_ifnum_to_if </b>(</code></td><td>const struct usb_device * <var class="pdparam">dev</var>, </td></tr><tr><td>&#160;</td><td>unsigned <var class="pdparam">ifnum</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1116466524"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>dev</code></em></span></dt><dd><p>
4     the device whose current configuration is considered
5    </p></dd><dt><span class="term"><em class="parameter"><code>ifnum</code></em></span></dt><dd><p>
6     the desired interface
7    </p></dd></dl></div></div><div class="refsect1"><a name="idp1116469116"></a><h2>Description</h2><p>
8   This walks the device descriptor for the currently active configuration
9   to find the interface object with the particular interface number.
10   </p><p>
11
12   Note that configuration descriptors are not required to assign interface
13   numbers sequentially, so that it would be incorrect to assume that
14   the first interface in that descriptor corresponds to interface zero.
15   This routine helps device drivers avoid such mistakes.
16   However, you should make sure that you do the right thing with any
17   alternate settings available for this interfaces.
18   </p><p>
19
20   Don't call this function unless you are bound to one of the interfaces
21   on this device or you have locked the device!
22</p></div><div class="refsect1"><a name="idp1116470660"></a><h2>Return</h2><p>
23   A pointer to the interface that has <em class="parameter"><code>ifnum</code></em> as interface number,
24   if found. <code class="constant">NULL</code> otherwise.
25</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-find-alt-setting.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="usbcore.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-usb-altnum-to-altsetting.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">usb_find_alt_setting</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">usb_altnum_to_altsetting</span></td></tr></table></div></body></html>
26