Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 670855e33fa56439033e33bd4989726e > files > 45

libusbx-devel-doc-1.0.17-2.mga4.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Synchronous device I/O</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
    <td style="padding-left: 0.5em;">
    <div id="projectbrief">eXpand your USB potential</div>
    </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Synchronous device I/O</div>  </div>
</div><!--header-->
<div class="contents">

<p>This page documents libusbx's synchronous (blocking) API for USB device I/O.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gadb11f7a761bd12fc77a07f4568d56f38"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__syncio.html#gadb11f7a761bd12fc77a07f4568d56f38">libusb_control_transfer</a> (<a class="el" href="group__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a> *dev_handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, unsigned char *data, uint16_t wLength, unsigned int timeout)</td></tr>
<tr class="memdesc:gadb11f7a761bd12fc77a07f4568d56f38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform a USB control transfer.  <a href="#gadb11f7a761bd12fc77a07f4568d56f38">More...</a><br/></td></tr>
<tr class="separator:gadb11f7a761bd12fc77a07f4568d56f38"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab8ae853ab492c22d707241dc26c8a805"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__syncio.html#gab8ae853ab492c22d707241dc26c8a805">libusb_bulk_transfer</a> (struct <a class="el" href="group__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a> *dev_handle, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout)</td></tr>
<tr class="memdesc:gab8ae853ab492c22d707241dc26c8a805"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform a USB bulk transfer.  <a href="#gab8ae853ab492c22d707241dc26c8a805">More...</a><br/></td></tr>
<tr class="separator:gab8ae853ab492c22d707241dc26c8a805"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac412bda21b7ecf57e4c76877d78e6486"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__syncio.html#gac412bda21b7ecf57e4c76877d78e6486">libusb_interrupt_transfer</a> (struct <a class="el" href="group__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a> *dev_handle, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout)</td></tr>
<tr class="memdesc:gac412bda21b7ecf57e4c76877d78e6486"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform a USB interrupt transfer.  <a href="#gac412bda21b7ecf57e4c76877d78e6486">More...</a><br/></td></tr>
<tr class="separator:gac412bda21b7ecf57e4c76877d78e6486"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This page documents libusbx's synchronous (blocking) API for USB device I/O. </p>
<p>This interface is easy to use but has some limitations. More advanced users may wish to consider using the <a class="el" href="group__asyncio.html">asynchronous I/O API</a> instead. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gadb11f7a761bd12fc77a07f4568d56f38"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libusb_control_transfer </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a> *&#160;</td>
          <td class="paramname"><em>dev_handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>bmRequestType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>bRequest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>wValue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>wIndex</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>wLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform a USB control transfer. </p>
<p>The direction of the transfer is inferred from the bmRequestType field of the setup packet.</p>
<p>The wValue, wIndex and wLength fields values should be given in host-endian byte order.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dev_handle</td><td>a handle for the device to communicate with </td></tr>
    <tr><td class="paramname">bmRequestType</td><td>the request type field for the setup packet </td></tr>
    <tr><td class="paramname">bRequest</td><td>the request field for the setup packet </td></tr>
    <tr><td class="paramname">wValue</td><td>the value field for the setup packet </td></tr>
    <tr><td class="paramname">wIndex</td><td>the index field for the setup packet </td></tr>
    <tr><td class="paramname">data</td><td>a suitably-sized data buffer for either input or output (depending on direction bits within bmRequestType) </td></tr>
    <tr><td class="paramname">wLength</td><td>the length field for the setup packet. The data buffer should be at least this size. </td></tr>
    <tr><td class="paramname">timeout</td><td>timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use value 0. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>on success, the number of bytes actually transferred </dd>
<dd>
LIBUSB_ERROR_TIMEOUT if the transfer timed out </dd>
<dd>
LIBUSB_ERROR_PIPE if the control request was not supported by the device </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
another LIBUSB_ERROR code on other failures </dd></dl>

</div>
</div>
<a class="anchor" id="gab8ae853ab492c22d707241dc26c8a805"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libusb_bulk_transfer </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="group__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a> *&#160;</td>
          <td class="paramname"><em>dev_handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>endpoint</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>transferred</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform a USB bulk transfer. </p>
<p>The direction of the transfer is inferred from the direction bits of the endpoint address.</p>
<p>For bulk reads, the <code>length</code> field indicates the maximum length of data you are expecting to receive. If less data arrives than expected, this function will return that data, so be sure to check the <code>transferred</code> output parameter.</p>
<p>You should also check the <code>transferred</code> parameter for bulk writes. Not all of the data may have been written.</p>
<p>Also check <code>transferred</code> when dealing with a timeout error code. libusbx may have to split your transfer into a number of chunks to satisfy underlying O/S requirements, meaning that the timeout may expire after the first few chunks have completed. libusbx is careful not to lose any data that may have been transferred; do not assume that timeout conditions indicate a complete lack of I/O.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dev_handle</td><td>a handle for the device to communicate with </td></tr>
    <tr><td class="paramname">endpoint</td><td>the address of a valid endpoint to communicate with </td></tr>
    <tr><td class="paramname">data</td><td>a suitably-sized data buffer for either input or output (depending on endpoint) </td></tr>
    <tr><td class="paramname">length</td><td>for bulk writes, the number of bytes from data to be sent. for bulk reads, the maximum number of bytes to receive into the data buffer. </td></tr>
    <tr><td class="paramname">transferred</td><td>output location for the number of bytes actually transferred. </td></tr>
    <tr><td class="paramname">timeout</td><td>timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use value 0.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success (and populates <code>transferred</code>) </dd>
<dd>
LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates <code>transferred</code>) </dd>
<dd>
LIBUSB_ERROR_PIPE if the endpoint halted </dd>
<dd>
LIBUSB_ERROR_OVERFLOW if the device offered more data, see <a class="el" href="packetoverflow.html">Packets and overflows</a> </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
another LIBUSB_ERROR code on other failures </dd></dl>

</div>
</div>
<a class="anchor" id="gac412bda21b7ecf57e4c76877d78e6486"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libusb_interrupt_transfer </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="group__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a> *&#160;</td>
          <td class="paramname"><em>dev_handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>endpoint</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>transferred</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform a USB interrupt transfer. </p>
<p>The direction of the transfer is inferred from the direction bits of the endpoint address.</p>
<p>For interrupt reads, the <code>length</code> field indicates the maximum length of data you are expecting to receive. If less data arrives than expected, this function will return that data, so be sure to check the <code>transferred</code> output parameter.</p>
<p>You should also check the <code>transferred</code> parameter for interrupt writes. Not all of the data may have been written.</p>
<p>Also check <code>transferred</code> when dealing with a timeout error code. libusbx may have to split your transfer into a number of chunks to satisfy underlying O/S requirements, meaning that the timeout may expire after the first few chunks have completed. libusbx is careful not to lose any data that may have been transferred; do not assume that timeout conditions indicate a complete lack of I/O.</p>
<p>The default endpoint bInterval value is used as the polling interval.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dev_handle</td><td>a handle for the device to communicate with </td></tr>
    <tr><td class="paramname">endpoint</td><td>the address of a valid endpoint to communicate with </td></tr>
    <tr><td class="paramname">data</td><td>a suitably-sized data buffer for either input or output (depending on endpoint) </td></tr>
    <tr><td class="paramname">length</td><td>for bulk writes, the number of bytes from data to be sent. for bulk reads, the maximum number of bytes to receive into the data buffer. </td></tr>
    <tr><td class="paramname">transferred</td><td>output location for the number of bytes actually transferred. </td></tr>
    <tr><td class="paramname">timeout</td><td>timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use value 0.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success (and populates <code>transferred</code>) </dd>
<dd>
LIBUSB_ERROR_TIMEOUT if the transfer timed out </dd>
<dd>
LIBUSB_ERROR_PIPE if the endpoint halted </dd>
<dd>
LIBUSB_ERROR_OVERFLOW if the device offered more data, see <a class="el" href="packetoverflow.html">Packets and overflows</a> </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
another LIBUSB_ERROR code on other error </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Oct 19 2013 16:44:34 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>