1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>usb_set_interface</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 5. USB Core APIs"><link rel="prev" href="API-usb-reset-endpoint.html" title="usb_reset_endpoint"><link rel="next" href="API-usb-reset-configuration.html" title="usb_reset_configuration"></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_set_interface</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-usb-reset-endpoint.html">Prev</a> </td><th width="60%" align="center">Chapter 5. USB Core APIs</th><td width="20%" align="right"> <a accesskey="n" href="API-usb-reset-configuration.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-usb-set-interface"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>usb_set_interface — 2 Makes a particular alternate setting be current 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_set_interface </b>(</code></td><td>struct usb_device * <var class="pdparam">dev</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">interface</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">alternate</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1116268484"></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 interface is being updated 5 </p></dd><dt><span class="term"><em class="parameter"><code>interface</code></em></span></dt><dd><p> 6 the interface being updated 7 </p></dd><dt><span class="term"><em class="parameter"><code>alternate</code></em></span></dt><dd><p> 8 the setting being chosen. 9 </p></dd></dl></div></div><div class="refsect1"><a name="idp1116272076"></a><h2>Context</h2><p> 10 !in_interrupt () 11</p></div><div class="refsect1"><a name="idp1116272652"></a><h2>Description</h2><p> 12 This is used to enable data transfers on interfaces that may not 13 be enabled by default. Not all devices support such configurability. 14 Only the driver bound to an interface may change its setting. 15 </p><p> 16 17 Within any given configuration, each interface may have several 18 alternative settings. These are often used to control levels of 19 bandwidth consumption. For example, the default setting for a high 20 speed interrupt endpoint may not send more than 64 bytes per microframe, 21 while interrupt transfers of up to 3KBytes per microframe are legal. 22 Also, isochronous endpoints may never be part of an 23 interface's default setting. To access such bandwidth, alternate 24 interface settings must be made current. 25 </p><p> 26 27 Note that in the Linux USB subsystem, bandwidth associated with 28 an endpoint in a given alternate setting is not reserved until an URB 29 is submitted that needs that bandwidth. Some other operating systems 30 allocate bandwidth early, when a configuration is chosen. 31 </p><p> 32 33 This call is synchronous, and may not be used in an interrupt context. 34 Also, drivers must not change altsettings while urbs are scheduled for 35 endpoints in that interface; all such urbs must first be completed 36 (perhaps forced by unlinking). 37</p></div><div class="refsect1"><a name="idp1116274916"></a><h2>Return</h2><p> 38 Zero on success, or else the status code returned by the 39 underlying <code class="function">usb_control_msg</code> call. 40</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-reset-endpoint.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="usbcore.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-usb-reset-configuration.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">usb_reset_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 class="phrase">usb_reset_configuration</span></td></tr></table></div></body></html> 41