Blob Blame History Raw
<!-- HTML header for doxygen 1.8.8-->
<!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="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.15"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>libevdev: Multi-touch related functions</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></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>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
<link href="libevdevdoxygen.css" rel="stylesheet" type="text/css"/>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="doxy-boot.js"></script>
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">libevdev 1.8.0</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel panel-default" style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- 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">Multi-touch related functions</div>  </div>
</div><!--header-->
<div class="contents">

<p>Functions for querying multi-touch-related capabilities.  
<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:ga8c6303391cb4f90b2d46763cf4eb8bc8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mt.html#ga8c6303391cb4f90b2d46763cf4eb8bc8">libevdev_get_slot_value</a> (const struct libevdev *dev, unsigned int slot, unsigned int code)</td></tr>
<tr class="memdesc:ga8c6303391cb4f90b2d46763cf4eb8bc8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current value of the code for the given slot.  <a href="#ga8c6303391cb4f90b2d46763cf4eb8bc8">More...</a><br /></td></tr>
<tr class="separator:ga8c6303391cb4f90b2d46763cf4eb8bc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaca19dca5aa8f0ea3b210f3fc670384ec"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mt.html#gaca19dca5aa8f0ea3b210f3fc670384ec">libevdev_fetch_slot_value</a> (const struct libevdev *dev, unsigned int slot, unsigned int code, int *value)</td></tr>
<tr class="memdesc:gaca19dca5aa8f0ea3b210f3fc670384ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fetch the current value of the code for the given slot.  <a href="#gaca19dca5aa8f0ea3b210f3fc670384ec">More...</a><br /></td></tr>
<tr class="separator:gaca19dca5aa8f0ea3b210f3fc670384ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf272526f0a59d2f61ef7389046cd4088"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mt.html#gaf272526f0a59d2f61ef7389046cd4088">libevdev_get_num_slots</a> (const struct libevdev *dev)</td></tr>
<tr class="memdesc:gaf272526f0a59d2f61ef7389046cd4088"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of slots supported by this device.  <a href="#gaf272526f0a59d2f61ef7389046cd4088">More...</a><br /></td></tr>
<tr class="separator:gaf272526f0a59d2f61ef7389046cd4088"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad22e2420be668b56ef486cde2e98c5dd"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mt.html#gad22e2420be668b56ef486cde2e98c5dd">libevdev_get_current_slot</a> (const struct libevdev *dev)</td></tr>
<tr class="memdesc:gad22e2420be668b56ef486cde2e98c5dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the currently active slot.  <a href="#gad22e2420be668b56ef486cde2e98c5dd">More...</a><br /></td></tr>
<tr class="separator:gad22e2420be668b56ef486cde2e98c5dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Functions for querying multi-touch-related capabilities. </p>
<p>MT devices following the kernel protocol B (using ABS_MT_SLOT) provide multiple touch points through so-called slots on the same axis. The slots are enumerated, a client reading from the device will first get an ABS_MT_SLOT event, then the values of axes changed in this slot. Multiple slots may be provided in before an EV_SYN event.</p>
<p>As with <a class="el" href="group__bits.html">Querying device capabilities</a>, the logical state of the device as seen by the library depends on the caller using <a class="el" href="group__events.html#gabb96c864e836c0b98788f4ab771c3a76" title="Get the next event from the device.">libevdev_next_event()</a>.</p>
<p>The Linux kernel requires all axes on a device to have a semantic meaning, matching the axis names in linux/input.h. Some devices merely export a number of axes beyond the available axis list. For those devices, the multitouch information is invalid. Specifically, if a device provides the ABS_MT_SLOT axis AND also the ABS_RESERVED axis, the device is not treated as multitouch device. No slot information is available and the ABS_MT axis range for these devices is treated as all other EV_ABS axes.</p>
<p>Note that because of limitations in the kernel API, such fake multitouch devices can not be reliably synced after a SYN_DROPPED event. libevdev ignores all ABS_MT axis values during the sync process and instead relies on the device to send the current axis value with the first event after SYN_DROPPED. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaca19dca5aa8f0ea3b210f3fc670384ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaca19dca5aa8f0ea3b210f3fc670384ec">&#9670;&nbsp;</a></span>libevdev_fetch_slot_value()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libevdev_fetch_slot_value </td>
          <td>(</td>
          <td class="paramtype">const struct libevdev *&#160;</td>
          <td class="paramname"><em>dev</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>slot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>code</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fetch the current value of the code for the given slot. </p>
<p>This is a shortcut for</p>
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code" href="group__bits.html#ga398bef155fa4a0cfb832de30723ebd14">libevdev_has_event_type</a>(dev, EV_ABS) &amp;&amp;</div><div class="line">    <a class="code" href="group__bits.html#gab2ab9dad417f33daa79fa0c3d682df0b">libevdev_has_event_code</a>(dev, EV_ABS, c) &amp;&amp;</div><div class="line">    slot &lt; device-&gt;number_of_slots)</div><div class="line">    val = <a class="code" href="group__mt.html#ga8c6303391cb4f90b2d46763cf4eb8bc8">libevdev_get_slot_value</a>(dev, slot, c);</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">dev</td><td>The evdev device, already initialized with <a class="el" href="group__init.html#ga6658ac490d68c307ff8b8d1536c12b44" title="Set the fd for this struct and initialize internal data.">libevdev_set_fd()</a> </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">slot</td><td>The numerical slot number, must be smaller than the total number of slots on this * device </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>The current value of this axis returned.</td></tr>
    <tr><td class="paramdir"></td><td class="paramname">code</td><td>The event code to query for, one of ABS_MT_POSITION_X, etc. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>If the device supports this event code, the return value is non-zero and value is set to the current value of this axis. Otherwise, or if the event code is not an ABS_MT_* event code, 0 is returned and value is unmodified.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function is signal-safe. </dd></dl>

</div>
</div>
<a id="gad22e2420be668b56ef486cde2e98c5dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad22e2420be668b56ef486cde2e98c5dd">&#9670;&nbsp;</a></span>libevdev_get_current_slot()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libevdev_get_current_slot </td>
          <td>(</td>
          <td class="paramtype">const struct libevdev *&#160;</td>
          <td class="paramname"><em>dev</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the currently active slot. </p>
<p>This may differ from the value an ioctl may return at this time as events may have been read off the fd since changing the slot value but those events are still in the buffer waiting to be processed. The returned value is the value a caller would see if it were to process events manually one-by-one.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dev</td><td>The evdev device, already initialized with <a class="el" href="group__init.html#ga6658ac490d68c307ff8b8d1536c12b44" title="Set the fd for this struct and initialize internal data.">libevdev_set_fd()</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the currently active slot (logically)</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function is signal-safe. </dd></dl>

</div>
</div>
<a id="gaf272526f0a59d2f61ef7389046cd4088"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf272526f0a59d2f61ef7389046cd4088">&#9670;&nbsp;</a></span>libevdev_get_num_slots()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libevdev_get_num_slots </td>
          <td>(</td>
          <td class="paramtype">const struct libevdev *&#160;</td>
          <td class="paramname"><em>dev</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the number of slots supported by this device. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dev</td><td>The evdev device, already initialized with <a class="el" href="group__init.html#ga6658ac490d68c307ff8b8d1536c12b44" title="Set the fd for this struct and initialize internal data.">libevdev_set_fd()</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of slots supported, or -1 if the device does not provide any slots</dd></dl>
<dl class="section note"><dt>Note</dt><dd>A device may provide ABS_MT_SLOT but a total number of 0 slots. Hence the return value of -1 for "device does not provide slots at all" </dd></dl>

</div>
</div>
<a id="ga8c6303391cb4f90b2d46763cf4eb8bc8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8c6303391cb4f90b2d46763cf4eb8bc8">&#9670;&nbsp;</a></span>libevdev_get_slot_value()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int libevdev_get_slot_value </td>
          <td>(</td>
          <td class="paramtype">const struct libevdev *&#160;</td>
          <td class="paramname"><em>dev</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>slot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>code</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the current value of the code for the given slot. </p>
<p>The return value is undefined for a slot exceeding the available slots on the device, for a code that is not in the permitted ABS_MT range or for a device that does not have slots.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dev</td><td>The evdev device, already initialized with <a class="el" href="group__init.html#ga6658ac490d68c307ff8b8d1536c12b44" title="Set the fd for this struct and initialize internal data.">libevdev_set_fd()</a> </td></tr>
    <tr><td class="paramname">slot</td><td>The numerical slot number, must be smaller than the total number of slots on this device </td></tr>
    <tr><td class="paramname">code</td><td>The event code to query for, one of ABS_MT_POSITION_X, etc.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This function is signal-safe. </dd>
<dd>
The value for events other than ABS_MT_ is undefined, use libevdev_fetch_value() instead</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__bits.html#ga6259f4c6bdba950329ff9cd48c2ef8a3" title="Behaviour of this function is undefined if the device does not provide the event.">libevdev_get_event_value</a> </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>