• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- HTML header for doxygen 1.8.8-->
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4    <head>
5        <meta http-equiv="X-UA-Compatible" content="IE=edge">
6        <!-- For Mobile Devices -->
7        <meta name="viewport" content="width=device-width, initial-scale=1">
8        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
9        <meta name="generator" content="Doxygen 1.9.1"/>
10        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
11        <title>libevdev: Multi-touch related functions</title>
12        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
13        <script type="text/javascript" src="dynsections.js"></script>
14        <link href="search/search.css" rel="stylesheet" type="text/css"/>
15<script type="text/javascript" src="search/searchdata.js"></script>
16<script type="text/javascript" src="search/search.js"></script>
17        <link href="doxygen.css" rel="stylesheet" type="text/css" />
18        <link href="bootstrap.css" rel="stylesheet" type="text/css"/>
19<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
20<link href="libevdevdoxygen.css" rel="stylesheet" type="text/css"/>
21        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
22        <script type="text/javascript" src="doxy-boot.js"></script>
23    </head>
24    <body>
25        <nav class="navbar navbar-default" role="navigation">
26            <div class="container">
27                <div class="navbar-header">
28                    <a class="navbar-brand">libevdev 1.12.1</a>
29                </div>
30            </div>
31        </nav>
32        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
33            <div class="content" id="content">
34                <div class="container">
35                    <div class="row">
36                        <div class="col-sm-12 panel panel-default" style="padding-bottom: 15px;">
37                            <div style="margin-bottom: 15px;">
38<!-- end header part -->
39<!-- Generated by Doxygen 1.9.1 -->
40<script type="text/javascript">
41/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
42var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
43/* @license-end */
44</script>
45<script type="text/javascript" src="menudata.js"></script>
46<script type="text/javascript" src="menu.js"></script>
47<script type="text/javascript">
48/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
49$(function() {
50  initMenu('',true,false,'search.php','Search');
51  $(document).ready(function() { init_search(); });
52});
53/* @license-end */</script>
54<div id="main-nav"></div>
55</div><!-- top -->
56<!-- window showing the filter options -->
57<div id="MSearchSelectWindow"
58     onmouseover="return searchBox.OnSearchSelectShow()"
59     onmouseout="return searchBox.OnSearchSelectHide()"
60     onkeydown="return searchBox.OnSearchSelectKey(event)">
61</div>
62
63<!-- iframe showing the search results (closed by default) -->
64<div id="MSearchResultsWindow">
65<iframe src="javascript:void(0)" frameborder="0"
66        name="MSearchResults" id="MSearchResults">
67</iframe>
68</div>
69
70<div class="header">
71  <div class="summary">
72<a href="#func-members">Functions</a>  </div>
73  <div class="headertitle">
74<div class="title">Multi-touch related functions</div>  </div>
75</div><!--header-->
76<div class="contents">
77
78<p>Functions for querying multi-touch-related capabilities.
79<a href="#details">More...</a></p>
80<table class="memberdecls">
81<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
82Functions</h2></td></tr>
83<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>
84<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="group__mt.html#ga8c6303391cb4f90b2d46763cf4eb8bc8">More...</a><br /></td></tr>
85<tr class="separator:ga8c6303391cb4f90b2d46763cf4eb8bc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
86<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>
87<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="group__mt.html#gaca19dca5aa8f0ea3b210f3fc670384ec">More...</a><br /></td></tr>
88<tr class="separator:gaca19dca5aa8f0ea3b210f3fc670384ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
89<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>
90<tr class="memdesc:gaf272526f0a59d2f61ef7389046cd4088"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of slots supported by this device.  <a href="group__mt.html#gaf272526f0a59d2f61ef7389046cd4088">More...</a><br /></td></tr>
91<tr class="separator:gaf272526f0a59d2f61ef7389046cd4088"><td class="memSeparator" colspan="2">&#160;</td></tr>
92<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>
93<tr class="memdesc:gad22e2420be668b56ef486cde2e98c5dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the currently active slot.  <a href="group__mt.html#gad22e2420be668b56ef486cde2e98c5dd">More...</a><br /></td></tr>
94<tr class="separator:gad22e2420be668b56ef486cde2e98c5dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
95</table>
96<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
97<p>Functions for querying multi-touch-related capabilities. </p>
98<p>MT devices following the kernel protocol B (using <code>ABS_MT_SLOT</code>) 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 <code>EV_SYN</code> event.</p>
99<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>
100<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 <code>ABS_MT_SLOT</code> axis AND also the <code>ABS_RESERVED</code> axis, the device is not treated as multitouch device. No slot information is available and the <code>ABS_MT</code> axis range for these devices is treated as all other <code>EV_ABS</code> axes.</p>
101<p>Note that because of limitations in the kernel API, such fake multitouch devices can not be reliably synced after a <code>SYN_DROPPED</code> event. libevdev ignores all <code>ABS_MT</code> axis values during the sync process and instead relies on the device to send the current axis value with the first event after <code>SYN_DROPPED</code>. </p>
102<h2 class="groupheader">Function Documentation</h2>
103<a id="gaca19dca5aa8f0ea3b210f3fc670384ec"></a>
104<h2 class="memtitle"><span class="permalink"><a href="#gaca19dca5aa8f0ea3b210f3fc670384ec">&#9670;&nbsp;</a></span>libevdev_fetch_slot_value()</h2>
105
106<div class="memitem">
107<div class="memproto">
108      <table class="memname">
109        <tr>
110          <td class="memname">int libevdev_fetch_slot_value </td>
111          <td>(</td>
112          <td class="paramtype">const struct libevdev *&#160;</td>
113          <td class="paramname"><em>dev</em>, </td>
114        </tr>
115        <tr>
116          <td class="paramkey"></td>
117          <td></td>
118          <td class="paramtype">unsigned int&#160;</td>
119          <td class="paramname"><em>slot</em>, </td>
120        </tr>
121        <tr>
122          <td class="paramkey"></td>
123          <td></td>
124          <td class="paramtype">unsigned int&#160;</td>
125          <td class="paramname"><em>code</em>, </td>
126        </tr>
127        <tr>
128          <td class="paramkey"></td>
129          <td></td>
130          <td class="paramtype">int *&#160;</td>
131          <td class="paramname"><em>value</em>&#160;</td>
132        </tr>
133        <tr>
134          <td></td>
135          <td>)</td>
136          <td></td><td></td>
137        </tr>
138      </table>
139</div><div class="memdoc">
140
141<p>Fetch the current value of the code for the given slot. </p>
142<p>This is a shortcut for</p>
143<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>
144<div class="line">    <a class="code" href="group__bits.html#gab2ab9dad417f33daa79fa0c3d682df0b">libevdev_has_event_code</a>(dev, EV_ABS, c) &amp;&amp;</div>
145<div class="line">    slot &lt; device-&gt;number_of_slots)</div>
146<div class="line">    val = <a class="code" href="group__mt.html#ga8c6303391cb4f90b2d46763cf4eb8bc8">libevdev_get_slot_value</a>(dev, slot, c);</div>
147<div class="ttc" id="agroup__bits_html_ga398bef155fa4a0cfb832de30723ebd14"><div class="ttname"><a href="group__bits.html#ga398bef155fa4a0cfb832de30723ebd14">libevdev_has_event_type</a></div><div class="ttdeci">int libevdev_has_event_type(const struct libevdev *dev, unsigned int type)</div></div>
148<div class="ttc" id="agroup__bits_html_gab2ab9dad417f33daa79fa0c3d682df0b"><div class="ttname"><a href="group__bits.html#gab2ab9dad417f33daa79fa0c3d682df0b">libevdev_has_event_code</a></div><div class="ttdeci">int libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code)</div></div>
149<div class="ttc" id="agroup__mt_html_ga8c6303391cb4f90b2d46763cf4eb8bc8"><div class="ttname"><a href="group__mt.html#ga8c6303391cb4f90b2d46763cf4eb8bc8">libevdev_get_slot_value</a></div><div class="ttdeci">int libevdev_get_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code)</div><div class="ttdoc">Return the current value of the code for the given slot.</div></div>
150</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
151  <table class="params">
152    <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>
153    <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>
154    <tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>The current value of this axis returned.</td></tr>
155    <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>
156  </table>
157  </dd>
158</dl>
159<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>
160<dl class="section note"><dt>Note</dt><dd>This function is signal-safe. </dd></dl>
161
162</div>
163</div>
164<a id="gad22e2420be668b56ef486cde2e98c5dd"></a>
165<h2 class="memtitle"><span class="permalink"><a href="#gad22e2420be668b56ef486cde2e98c5dd">&#9670;&nbsp;</a></span>libevdev_get_current_slot()</h2>
166
167<div class="memitem">
168<div class="memproto">
169      <table class="memname">
170        <tr>
171          <td class="memname">int libevdev_get_current_slot </td>
172          <td>(</td>
173          <td class="paramtype">const struct libevdev *&#160;</td>
174          <td class="paramname"><em>dev</em></td><td>)</td>
175          <td></td>
176        </tr>
177      </table>
178</div><div class="memdoc">
179
180<p>Get the currently active slot. </p>
181<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>
182<dl class="params"><dt>Parameters</dt><dd>
183  <table class="params">
184    <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>
185  </table>
186  </dd>
187</dl>
188<dl class="section return"><dt>Returns</dt><dd>the currently active slot (logically)</dd></dl>
189<dl class="section note"><dt>Note</dt><dd>This function is signal-safe. </dd></dl>
190
191</div>
192</div>
193<a id="gaf272526f0a59d2f61ef7389046cd4088"></a>
194<h2 class="memtitle"><span class="permalink"><a href="#gaf272526f0a59d2f61ef7389046cd4088">&#9670;&nbsp;</a></span>libevdev_get_num_slots()</h2>
195
196<div class="memitem">
197<div class="memproto">
198      <table class="memname">
199        <tr>
200          <td class="memname">int libevdev_get_num_slots </td>
201          <td>(</td>
202          <td class="paramtype">const struct libevdev *&#160;</td>
203          <td class="paramname"><em>dev</em></td><td>)</td>
204          <td></td>
205        </tr>
206      </table>
207</div><div class="memdoc">
208
209<p>Get the number of slots supported by this device. </p>
210<dl class="params"><dt>Parameters</dt><dd>
211  <table class="params">
212    <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>
213  </table>
214  </dd>
215</dl>
216<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>
217<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>
218
219</div>
220</div>
221<a id="ga8c6303391cb4f90b2d46763cf4eb8bc8"></a>
222<h2 class="memtitle"><span class="permalink"><a href="#ga8c6303391cb4f90b2d46763cf4eb8bc8">&#9670;&nbsp;</a></span>libevdev_get_slot_value()</h2>
223
224<div class="memitem">
225<div class="memproto">
226      <table class="memname">
227        <tr>
228          <td class="memname">int libevdev_get_slot_value </td>
229          <td>(</td>
230          <td class="paramtype">const struct libevdev *&#160;</td>
231          <td class="paramname"><em>dev</em>, </td>
232        </tr>
233        <tr>
234          <td class="paramkey"></td>
235          <td></td>
236          <td class="paramtype">unsigned int&#160;</td>
237          <td class="paramname"><em>slot</em>, </td>
238        </tr>
239        <tr>
240          <td class="paramkey"></td>
241          <td></td>
242          <td class="paramtype">unsigned int&#160;</td>
243          <td class="paramname"><em>code</em>&#160;</td>
244        </tr>
245        <tr>
246          <td></td>
247          <td>)</td>
248          <td></td><td></td>
249        </tr>
250      </table>
251</div><div class="memdoc">
252
253<p>Return the current value of the code for the given slot. </p>
254<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>
255<dl class="params"><dt>Parameters</dt><dd>
256  <table class="params">
257    <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>
258    <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>
259    <tr><td class="paramname">code</td><td>The event code to query for, one of ABS_MT_POSITION_X, etc.</td></tr>
260  </table>
261  </dd>
262</dl>
263<dl class="section note"><dt>Note</dt><dd>This function is signal-safe. </dd>
264<dd>
265The value for events other than ABS_MT_ is undefined, use libevdev_fetch_value() instead</dd></dl>
266<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>
267
268</div>
269</div>
270</div><!-- contents -->
271<!-- HTML footer for doxygen 1.8.8-->
272<!-- start footer part -->
273</div>
274</div>
275</div>
276</div>
277</div>
278<hr class="footer"/><address class="footer"><small>
279Generated by &#160;<a href="http://www.doxygen.org/index.html">
280<img class="footer" src="doxygen.png" alt="doxygen"/>
281</a> 1.9.1
282</small></address>
283</body>
284</html>
285