850 lines
46 KiB
HTML
850 lines
46 KiB
HTML
<!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.11"/>
|
|
<title>Kinetis Bootloader Host: hidapi API</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="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(initResizable);
|
|
$(window).load(resizeHeight);
|
|
</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { init_search(); });
|
|
</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 id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">Kinetis Bootloader Host
|
|
 <span id="projectnumber">2.0.0</span>
|
|
</div>
|
|
<div id="projectbrief">Host Tools for Kinetis devices</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.11 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Introduction</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){initNavTree('group___a_p_i.html','');});
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">hidapi API</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:ga142ffc1b0b7a7fa412d3862b2a17164b"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga142ffc1b0b7a7fa412d3862b2a17164b">hid_init</a> (void)</td></tr>
|
|
<tr class="memdesc:ga142ffc1b0b7a7fa412d3862b2a17164b"><td class="mdescLeft"> </td><td class="mdescRight">Initialize the HIDAPI library. <a href="#ga142ffc1b0b7a7fa412d3862b2a17164b">More...</a><br /></td></tr>
|
|
<tr class="separator:ga142ffc1b0b7a7fa412d3862b2a17164b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gacf5da9ce37132eba69fc259f17f13023"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gacf5da9ce37132eba69fc259f17f13023">hid_exit</a> (void)</td></tr>
|
|
<tr class="memdesc:gacf5da9ce37132eba69fc259f17f13023"><td class="mdescLeft"> </td><td class="mdescRight">Finalize the HIDAPI library. <a href="#gacf5da9ce37132eba69fc259f17f13023">More...</a><br /></td></tr>
|
|
<tr class="separator:gacf5da9ce37132eba69fc259f17f13023"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga135931e04d48078a9fb7aebf663676f9"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structhid__device__info.html">hid_device_info</a> HID_API_EXPORT *HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga135931e04d48078a9fb7aebf663676f9">hid_enumerate</a> (unsigned short vendor_id, unsigned short product_id)</td></tr>
|
|
<tr class="memdesc:ga135931e04d48078a9fb7aebf663676f9"><td class="mdescLeft"> </td><td class="mdescRight">Enumerate the HID Devices. <a href="#ga135931e04d48078a9fb7aebf663676f9">More...</a><br /></td></tr>
|
|
<tr class="separator:ga135931e04d48078a9fb7aebf663676f9"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gafc2d2adf71db3784b783b9a554527aa4"><td class="memItemLeft" align="right" valign="top">void HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gafc2d2adf71db3784b783b9a554527aa4">hid_free_enumeration</a> (struct <a class="el" href="structhid__device__info.html">hid_device_info</a> *devs)</td></tr>
|
|
<tr class="memdesc:gafc2d2adf71db3784b783b9a554527aa4"><td class="mdescLeft"> </td><td class="mdescRight">Free an enumeration Linked List. <a href="#gafc2d2adf71db3784b783b9a554527aa4">More...</a><br /></td></tr>
|
|
<tr class="separator:gafc2d2adf71db3784b783b9a554527aa4"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gae6910ed9f01c4a99d25539b16800e90c"><td class="memItemLeft" align="right" valign="top">HID_API_EXPORT hid_device *HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c">hid_open</a> (unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)</td></tr>
|
|
<tr class="memdesc:gae6910ed9f01c4a99d25539b16800e90c"><td class="mdescLeft"> </td><td class="mdescRight">Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. <a href="#gae6910ed9f01c4a99d25539b16800e90c">More...</a><br /></td></tr>
|
|
<tr class="separator:gae6910ed9f01c4a99d25539b16800e90c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga1e87518670f88540c920dc451df608ee"><td class="memItemLeft" align="right" valign="top">HID_API_EXPORT hid_device *HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga1e87518670f88540c920dc451df608ee">hid_open_path</a> (const char *path)</td></tr>
|
|
<tr class="memdesc:ga1e87518670f88540c920dc451df608ee"><td class="mdescLeft"> </td><td class="mdescRight">Open a HID device by its path name. <a href="#ga1e87518670f88540c920dc451df608ee">More...</a><br /></td></tr>
|
|
<tr class="separator:ga1e87518670f88540c920dc451df608ee"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gad14ea48e440cf5066df87cc6488493af"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gad14ea48e440cf5066df87cc6488493af">hid_write</a> (hid_device *device, const unsigned char *data, size_t length)</td></tr>
|
|
<tr class="memdesc:gad14ea48e440cf5066df87cc6488493af"><td class="mdescLeft"> </td><td class="mdescRight">Write an Output report to a HID device. <a href="#gad14ea48e440cf5066df87cc6488493af">More...</a><br /></td></tr>
|
|
<tr class="separator:gad14ea48e440cf5066df87cc6488493af"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaa5c9ed5aa290688ffac03343989ad75a"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaa5c9ed5aa290688ffac03343989ad75a">hid_read_timeout</a> (hid_device *dev, unsigned char *data, size_t length, int milliseconds)</td></tr>
|
|
<tr class="memdesc:gaa5c9ed5aa290688ffac03343989ad75a"><td class="mdescLeft"> </td><td class="mdescRight">Read an Input report from a HID device with timeout. <a href="#gaa5c9ed5aa290688ffac03343989ad75a">More...</a><br /></td></tr>
|
|
<tr class="separator:gaa5c9ed5aa290688ffac03343989ad75a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga6b820f3e72097cf7f994e33715dc7af1"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga6b820f3e72097cf7f994e33715dc7af1">hid_read</a> (hid_device *device, unsigned char *data, size_t length)</td></tr>
|
|
<tr class="memdesc:ga6b820f3e72097cf7f994e33715dc7af1"><td class="mdescLeft"> </td><td class="mdescRight">Read an Input report from a HID device. <a href="#ga6b820f3e72097cf7f994e33715dc7af1">More...</a><br /></td></tr>
|
|
<tr class="separator:ga6b820f3e72097cf7f994e33715dc7af1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaf9d54208d314047727598b506577bb87"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaf9d54208d314047727598b506577bb87">hid_set_nonblocking</a> (hid_device *device, int nonblock)</td></tr>
|
|
<tr class="memdesc:gaf9d54208d314047727598b506577bb87"><td class="mdescLeft"> </td><td class="mdescRight">Set the device handle to be non-blocking. <a href="#gaf9d54208d314047727598b506577bb87">More...</a><br /></td></tr>
|
|
<tr class="separator:gaf9d54208d314047727598b506577bb87"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gae43ab80f741786ac4374216658fd5ab3"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gae43ab80f741786ac4374216658fd5ab3">hid_send_feature_report</a> (hid_device *device, const unsigned char *data, size_t length)</td></tr>
|
|
<tr class="memdesc:gae43ab80f741786ac4374216658fd5ab3"><td class="mdescLeft"> </td><td class="mdescRight">Send a Feature report to the device. <a href="#gae43ab80f741786ac4374216658fd5ab3">More...</a><br /></td></tr>
|
|
<tr class="separator:gae43ab80f741786ac4374216658fd5ab3"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga34d43ac6da0fb785b88fcc2edf13ed65"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga34d43ac6da0fb785b88fcc2edf13ed65">hid_get_feature_report</a> (hid_device *device, unsigned char *data, size_t length)</td></tr>
|
|
<tr class="memdesc:ga34d43ac6da0fb785b88fcc2edf13ed65"><td class="mdescLeft"> </td><td class="mdescRight">Get a feature report from a HID device. <a href="#ga34d43ac6da0fb785b88fcc2edf13ed65">More...</a><br /></td></tr>
|
|
<tr class="separator:ga34d43ac6da0fb785b88fcc2edf13ed65"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga9b64828273b8dd052731e79ba9e1a516"><td class="memItemLeft" align="right" valign="top">void HID_API_EXPORT HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga9b64828273b8dd052731e79ba9e1a516">hid_close</a> (hid_device *device)</td></tr>
|
|
<tr class="memdesc:ga9b64828273b8dd052731e79ba9e1a516"><td class="mdescLeft"> </td><td class="mdescRight">Close a HID device. <a href="#ga9b64828273b8dd052731e79ba9e1a516">More...</a><br /></td></tr>
|
|
<tr class="separator:ga9b64828273b8dd052731e79ba9e1a516"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga2652b2ff0f3982a8c5791718e2a2e6cb"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga2652b2ff0f3982a8c5791718e2a2e6cb">hid_get_manufacturer_string</a> (hid_device *device, wchar_t *string, size_t maxlen)</td></tr>
|
|
<tr class="memdesc:ga2652b2ff0f3982a8c5791718e2a2e6cb"><td class="mdescLeft"> </td><td class="mdescRight">Get The Manufacturer String from a HID device. <a href="#ga2652b2ff0f3982a8c5791718e2a2e6cb">More...</a><br /></td></tr>
|
|
<tr class="separator:ga2652b2ff0f3982a8c5791718e2a2e6cb"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaa78526041c4bb470b2c1ad9eb0791c5f"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaa78526041c4bb470b2c1ad9eb0791c5f">hid_get_product_string</a> (hid_device *device, wchar_t *string, size_t maxlen)</td></tr>
|
|
<tr class="memdesc:gaa78526041c4bb470b2c1ad9eb0791c5f"><td class="mdescLeft"> </td><td class="mdescRight">Get The Product String from a HID device. <a href="#gaa78526041c4bb470b2c1ad9eb0791c5f">More...</a><br /></td></tr>
|
|
<tr class="separator:gaa78526041c4bb470b2c1ad9eb0791c5f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga73994b7820264d3604d6ee25de9c66be"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga73994b7820264d3604d6ee25de9c66be">hid_get_serial_number_string</a> (hid_device *device, wchar_t *string, size_t maxlen)</td></tr>
|
|
<tr class="memdesc:ga73994b7820264d3604d6ee25de9c66be"><td class="mdescLeft"> </td><td class="mdescRight">Get The Serial Number String from a HID device. <a href="#ga73994b7820264d3604d6ee25de9c66be">More...</a><br /></td></tr>
|
|
<tr class="separator:ga73994b7820264d3604d6ee25de9c66be"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga03810bc0be3c21e9229feff689a9de85"><td class="memItemLeft" align="right" valign="top">int HID_API_EXPORT_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga03810bc0be3c21e9229feff689a9de85">hid_get_indexed_string</a> (hid_device *device, int string_index, wchar_t *string, size_t maxlen)</td></tr>
|
|
<tr class="memdesc:ga03810bc0be3c21e9229feff689a9de85"><td class="mdescLeft"> </td><td class="mdescRight">Get a string from a HID device, based on its string index. <a href="#ga03810bc0be3c21e9229feff689a9de85">More...</a><br /></td></tr>
|
|
<tr class="separator:ga03810bc0be3c21e9229feff689a9de85"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga1b5c0ca1c785b8024f5eb46750a8f606"><td class="memItemLeft" align="right" valign="top">HID_API_EXPORT const wchar_t *HID_API_CALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga1b5c0ca1c785b8024f5eb46750a8f606">hid_error</a> (hid_device *device)</td></tr>
|
|
<tr class="memdesc:ga1b5c0ca1c785b8024f5eb46750a8f606"><td class="mdescLeft"> </td><td class="mdescRight">Get a string describing the last error which occurred. <a href="#ga1b5c0ca1c785b8024f5eb46750a8f606">More...</a><br /></td></tr>
|
|
<tr class="separator:ga1b5c0ca1c785b8024f5eb46750a8f606"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Usage Information</h2>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a class="anchor" id="ga9b64828273b8dd052731e79ba9e1a516"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void HID_API_EXPORT HID_API_CALL hid_close </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Close a HID device. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga135931e04d48078a9fb7aebf663676f9"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">struct <a class="el" href="structhid__device__info.html">hid_device_info</a> HID_API_EXPORT* HID_API_CALL hid_enumerate </td>
|
|
<td>(</td>
|
|
<td class="paramtype">unsigned short </td>
|
|
<td class="paramname"><em>vendor_id</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned short </td>
|
|
<td class="paramname"><em>product_id</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Enumerate the HID Devices. </p>
|
|
<p>This function returns a linked list of all the HID devices attached to the system which match vendor_id and product_id. If <code>vendor_id</code> is set to 0 then any vendor matches. If <code>product_id</code> is set to 0 then any product matches. If <code>vendor_id</code> and <code>product_id</code> are both set to 0, then all HID devices will be returned.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">vendor_id</td><td>The Vendor ID (VID) of the types of device to open. </td></tr>
|
|
<tr><td class="paramname">product_id</td><td>The Product ID (PID) of the types of device to open.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns a pointer to a linked list of type struct #hid_device, containing information about the HID devices attached to the system, or NULL in the case of failure. Free this linked list by calling <a class="el" href="group___a_p_i.html#gafc2d2adf71db3784b783b9a554527aa4" title="Free an enumeration Linked List. ">hid_free_enumeration()</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga1b5c0ca1c785b8024f5eb46750a8f606"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">HID_API_EXPORT const wchar_t* HID_API_CALL hid_error </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Get a string describing the last error which occurred. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns a string containing the last error which occurred or NULL if none has occurred. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gacf5da9ce37132eba69fc259f17f13023"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_exit </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Finalize the HIDAPI library. </p>
|
|
<p>This function frees all of the static data associated with HIDAPI. It should be called at the end of execution to avoid memory leaks.</p>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gafc2d2adf71db3784b783b9a554527aa4"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void HID_API_EXPORT HID_API_CALL hid_free_enumeration </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhid__device__info.html">hid_device_info</a> * </td>
|
|
<td class="paramname"><em>devs</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Free an enumeration Linked List. </p>
|
|
<p>This function frees a linked list created by <a class="el" href="group___a_p_i.html#ga135931e04d48078a9fb7aebf663676f9" title="Enumerate the HID Devices. ">hid_enumerate()</a>.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">devs</td><td>Pointer to a list of struct_device returned from <a class="el" href="group___a_p_i.html#ga135931e04d48078a9fb7aebf663676f9" title="Enumerate the HID Devices. ">hid_enumerate()</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga34d43ac6da0fb785b88fcc2edf13ed65"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_get_feature_report </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>length</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Get a feature report from a HID device. </p>
|
|
<p>Make sure to set the first byte of <code>data</code>[] to the Report ID of the report to be read. Make sure to allow space for this extra byte in <code>data</code>[].</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">data</td><td>A buffer to put the read data into, including the Report ID. Set the first byte of <code>data</code>[] to the Report ID of the report to be read. </td></tr>
|
|
<tr><td class="paramname">length</td><td>The number of bytes to read, including an extra byte for the report ID. The buffer can be longer than the actual report.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns the number of bytes read and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga03810bc0be3c21e9229feff689a9de85"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT_CALL hid_get_indexed_string </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>string_index</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">wchar_t * </td>
|
|
<td class="paramname"><em>string</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>maxlen</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Get a string from a HID device, based on its string index. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">string_index</td><td>The index of the string to get. </td></tr>
|
|
<tr><td class="paramname">string</td><td>A wide string buffer to put the data into. </td></tr>
|
|
<tr><td class="paramname">maxlen</td><td>The length of the buffer in multiples of wchar_t.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga2652b2ff0f3982a8c5791718e2a2e6cb"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT_CALL hid_get_manufacturer_string </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">wchar_t * </td>
|
|
<td class="paramname"><em>string</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>maxlen</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Get The Manufacturer String from a HID device. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">string</td><td>A wide string buffer to put the data into. </td></tr>
|
|
<tr><td class="paramname">maxlen</td><td>The length of the buffer in multiples of wchar_t.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaa78526041c4bb470b2c1ad9eb0791c5f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT_CALL hid_get_product_string </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">wchar_t * </td>
|
|
<td class="paramname"><em>string</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>maxlen</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Get The Product String from a HID device. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">string</td><td>A wide string buffer to put the data into. </td></tr>
|
|
<tr><td class="paramname">maxlen</td><td>The length of the buffer in multiples of wchar_t.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga73994b7820264d3604d6ee25de9c66be"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT_CALL hid_get_serial_number_string </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">wchar_t * </td>
|
|
<td class="paramname"><em>string</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>maxlen</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Get The Serial Number String from a HID device. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">string</td><td>A wide string buffer to put the data into. </td></tr>
|
|
<tr><td class="paramname">maxlen</td><td>The length of the buffer in multiples of wchar_t.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga142ffc1b0b7a7fa412d3862b2a17164b"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_init </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Initialize the HIDAPI library. </p>
|
|
<p>This function initializes the HIDAPI library. Calling it is not strictly necessary, as it will be called automatically by <a class="el" href="group___a_p_i.html#ga135931e04d48078a9fb7aebf663676f9" title="Enumerate the HID Devices. ">hid_enumerate()</a> and any of the hid_open_*() functions if it is needed. This function should be called at the beginning of execution however, if there is a chance of HIDAPI handles being opened by different threads simultaneously.</p>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gae6910ed9f01c4a99d25539b16800e90c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">HID_API_EXPORT hid_device* HID_API_CALL hid_open </td>
|
|
<td>(</td>
|
|
<td class="paramtype">unsigned short </td>
|
|
<td class="paramname"><em>vendor_id</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned short </td>
|
|
<td class="paramname"><em>product_id</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const wchar_t * </td>
|
|
<td class="paramname"><em>serial_number</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. </p>
|
|
<p>If <code>serial_number</code> is NULL, the first device with the specified VID and PID is opened.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">vendor_id</td><td>The Vendor ID (VID) of the device to open. </td></tr>
|
|
<tr><td class="paramname">product_id</td><td>The Product ID (PID) of the device to open. </td></tr>
|
|
<tr><td class="paramname">serial_number</td><td>The Serial Number of the device to open (Optionally NULL).</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns a pointer to a #hid_device object on success or NULL on failure. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga1e87518670f88540c920dc451df608ee"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">HID_API_EXPORT hid_device* HID_API_CALL hid_open_path </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>path</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Open a HID device by its path name. </p>
|
|
<p>The path name be determined by calling <a class="el" href="group___a_p_i.html#ga135931e04d48078a9fb7aebf663676f9" title="Enumerate the HID Devices. ">hid_enumerate()</a>, or a platform-specific path name can be used (eg: /dev/hidraw0 on Linux).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">path</td><td>The path name of the device to open</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns a pointer to a #hid_device object on success or NULL on failure. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga6b820f3e72097cf7f994e33715dc7af1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_read </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>length</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Read an Input report from a HID device. </p>
|
|
<p>Input reports are returned to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">data</td><td>A buffer to put the read data into. </td></tr>
|
|
<tr><td class="paramname">length</td><td>The number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns the actual number of bytes read and -1 on error. If no packet was available to be read and the handle is in non-blocking mode, this function returns 0. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaa5c9ed5aa290688ffac03343989ad75a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_read_timeout </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>dev</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned char * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>length</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>milliseconds</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Read an Input report from a HID device with timeout. </p>
|
|
<p>Input reports are returned to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">data</td><td>A buffer to put the read data into. </td></tr>
|
|
<tr><td class="paramname">length</td><td>The number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number. </td></tr>
|
|
<tr><td class="paramname">milliseconds</td><td>timeout in milliseconds or -1 for blocking wait.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns the actual number of bytes read and -1 on error. If no packet was available to be read within the timeout period, this function returns 0. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gae43ab80f741786ac4374216658fd5ab3"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_send_feature_report </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>length</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Send a Feature report to the device. </p>
|
|
<p>Feature reports are sent over the Control endpoint as a Set_Report transfer. The first byte of <code>data</code>[] must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to <a class="el" href="group___a_p_i.html#gae43ab80f741786ac4374216658fd5ab3" title="Send a Feature report to the device. ">hid_send_feature_report()</a> will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to <a class="el" href="group___a_p_i.html#gae43ab80f741786ac4374216658fd5ab3" title="Send a Feature report to the device. ">hid_send_feature_report()</a>: the Report ID (or 0x0, for devices which do not use numbered reports), followed by the report data (16 bytes). In this example, the length passed in would be 17.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">data</td><td>The data to send, including the report number as the first byte. </td></tr>
|
|
<tr><td class="paramname">length</td><td>The length in bytes of the data to send, including the report number.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns the actual number of bytes written and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaf9d54208d314047727598b506577bb87"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_set_nonblocking </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>nonblock</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Set the device handle to be non-blocking. </p>
|
|
<p>In non-blocking mode calls to <a class="el" href="group___a_p_i.html#ga6b820f3e72097cf7f994e33715dc7af1" title="Read an Input report from a HID device. ">hid_read()</a> will return immediately with a value of 0 if there is no data to be read. In blocking mode, <a class="el" href="group___a_p_i.html#ga6b820f3e72097cf7f994e33715dc7af1" title="Read an Input report from a HID device. ">hid_read()</a> will wait (block) until there is data to read before returning.</p>
|
|
<p>Nonblocking can be turned on and off at any time.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">nonblock</td><td>enable or not the nonblocking reads<ul>
|
|
<li>1 to enable nonblocking</li>
|
|
<li>0 to disable nonblocking.</li>
|
|
</ul>
|
|
</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns 0 on success and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gad14ea48e440cf5066df87cc6488493af"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int HID_API_EXPORT HID_API_CALL hid_write </td>
|
|
<td>(</td>
|
|
<td class="paramtype">hid_device * </td>
|
|
<td class="paramname"><em>device</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const unsigned char * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>length</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Write an Output report to a HID device. </p>
|
|
<p>The first byte of <code>data</code>[] must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to <a class="el" href="group___a_p_i.html#gad14ea48e440cf5066df87cc6488493af" title="Write an Output report to a HID device. ">hid_write()</a> will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to <a class="el" href="group___a_p_i.html#gad14ea48e440cf5066df87cc6488493af" title="Write an Output report to a HID device. ">hid_write()</a>, the Report ID (or 0x0, for devices with a single report), followed by the report data (16 bytes). In this example, the length passed in would be 17.</p>
|
|
<p><a class="el" href="group___a_p_i.html#gad14ea48e440cf5066df87cc6488493af" title="Write an Output report to a HID device. ">hid_write()</a> will send the data on the first OUT endpoint, if one exists. If it does not, it will send the data through the Control Endpoint (Endpoint 0).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">device</td><td>A device handle returned from <a class="el" href="group___a_p_i.html#gae6910ed9f01c4a99d25539b16800e90c" title="Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...">hid_open()</a>. </td></tr>
|
|
<tr><td class="paramname">data</td><td>The data to send, including the report number as the first byte. </td></tr>
|
|
<tr><td class="paramname">length</td><td>The length in bytes of the data to send.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>This function returns the actual number of bytes written and -1 on error. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">Generated on Mon Mar 7 2016 16:49:50 for Kinetis Bootloader Host by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|