<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libevdev.git/test/test-libevdev-events.c, branch libevdev-1.3.1</title>
<subtitle>gitlab.freedesktop.org: libevdev/libevdev.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/'/>
<entry>
<title>test: silence some valgrind warnings</title>
<updated>2014-04-27T22:27:06+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-04-24T01:08:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=9d22a523835bae8727c577ce7dff6b565ce4e064'/>
<id>9d22a523835bae8727c577ce7dff6b565ce4e064</id>
<content type='text'>
ioctl points to uninitialized bytes - correct but we didn't use those anyway.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ioctl points to uninitialized bytes - correct but we didn't use those anyway.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Drain all events before synchronizing after SYN_DROPPED</title>
<updated>2014-04-23T22:17:01+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-04-07T05:16:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=050bca91a1e8dd2e46c219c0b282092cb053166c'/>
<id>050bca91a1e8dd2e46c219c0b282092cb053166c</id>
<content type='text'>
The kernel ring buffer drops all events on SYN_DROPPED, but then continues to
fill up again. So by the time we read the events, the kernel's client buffer is
essentially like this:
  SYN_DROPPED, ev1, ev2, ev3, ...., evN

The kernel's device state represents the device after evN, and that is what
the ioctls return. For EV_KEY, EV_SND, EV_LED and EV_SW the kernel removes
potential duplicates from the client buffer [1], it doesn't do so for EV_ABS.

So we can't actually sync while there are events on the wire because the
events represent an earlier state. So simply discard all events in the kernel
buffer, synchronize, and then start processing again. We lose some granularity
but at least the events are correct.

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/input/evdev.c?id=483180281f0ac60d1138710eb21f4b9961901294

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The kernel ring buffer drops all events on SYN_DROPPED, but then continues to
fill up again. So by the time we read the events, the kernel's client buffer is
essentially like this:
  SYN_DROPPED, ev1, ev2, ev3, ...., evN

The kernel's device state represents the device after evN, and that is what
the ioctls return. For EV_KEY, EV_SND, EV_LED and EV_SW the kernel removes
potential duplicates from the client buffer [1], it doesn't do so for EV_ABS.

So we can't actually sync while there are events on the wire because the
events represent an earlier state. So simply discard all events in the kernel
buffer, synchronize, and then start processing again. We lose some granularity
but at least the events are correct.

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/input/evdev.c?id=483180281f0ac60d1138710eb21f4b9961901294

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Drop invalid ABS_MT_TRACKING_ID changes</title>
<updated>2014-04-03T03:31:40+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-04-01T07:01:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=6cbf971b3969de37a2a8e5c6cb02a0648210a6af'/>
<id>6cbf971b3969de37a2a8e5c6cb02a0648210a6af</id>
<content type='text'>
Follow-up to
commit 41334b5b40cd5456f5f584b55d8888aaafa1f26e
Author: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Date:   Thu Mar 6 11:54:00 2014 +1000

    If the tracking ID changes during SYN_DROPPED, terminate the touch first

In normal mode, we may get double tracking ID events in the same slot, but
only if we either have a user-generated event sequence (uinput) or a malicious
device that tries to send data on a slot &gt; dev-&gt;num_slots.
Since the client is unlikely to be able to handle these events, discard the
ABS_MT_TRACKING_ID completely. This is a bug somewhere in the stack, so
complain and hobble on along.

Note: the kernel doesn't allow that, but we cap to num_slots anyway, see
66fee1bec4c4b021e1b54adcd775cf6e2aa84869.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Follow-up to
commit 41334b5b40cd5456f5f584b55d8888aaafa1f26e
Author: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Date:   Thu Mar 6 11:54:00 2014 +1000

    If the tracking ID changes during SYN_DROPPED, terminate the touch first

In normal mode, we may get double tracking ID events in the same slot, but
only if we either have a user-generated event sequence (uinput) or a malicious
device that tries to send data on a slot &gt; dev-&gt;num_slots.
Since the client is unlikely to be able to handle these events, discard the
ABS_MT_TRACKING_ID completely. This is a bug somewhere in the stack, so
complain and hobble on along.

Note: the kernel doesn't allow that, but we cap to num_slots anyway, see
66fee1bec4c4b021e1b54adcd775cf6e2aa84869.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Drop hardcoded MAX_SLOTS in favour of pre-allocated memory</title>
<updated>2014-04-03T03:30:49+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-04-01T05:32:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=f8fba5b5884bfb62225b9bde991dfdbec92ad751'/>
<id>f8fba5b5884bfb62225b9bde991dfdbec92ad751</id>
<content type='text'>
We can't allocate in sync_mt_state since it may be called in the signal
handler. So pre-allocate based on the device's number of slots, store that in
the libevdev struct and use it for the sync process.

This fixes a remaining bug with the handling of ABS_MT_TRACKING_ID. If a
device had &gt; MAX_SLOTS and a slot above that limit would start or stop during
a SYN_DROPPED event, the slot would not be synced, and a subsequent touch in
that slot may double-terminate or double-open a touchpoint in the client.
For the effects of that see

commit 41334b5b40cd5456f5f584b55d8888aaafa1f26e
Author: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Date:   Thu Mar 6 11:54:00 2014 +1000

    If the tracking ID changes during SYN_DROPPED, terminate the touch first

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can't allocate in sync_mt_state since it may be called in the signal
handler. So pre-allocate based on the device's number of slots, store that in
the libevdev struct and use it for the sync process.

This fixes a remaining bug with the handling of ABS_MT_TRACKING_ID. If a
device had &gt; MAX_SLOTS and a slot above that limit would start or stop during
a SYN_DROPPED event, the slot would not be synced, and a subsequent touch in
that slot may double-terminate or double-open a touchpoint in the client.
For the effects of that see

commit 41334b5b40cd5456f5f584b55d8888aaafa1f26e
Author: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Date:   Thu Mar 6 11:54:00 2014 +1000

    If the tracking ID changes during SYN_DROPPED, terminate the touch first

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: remove checks for test device creation failure</title>
<updated>2014-04-02T01:35:56+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-04-02T01:12:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=c97839a81ebbc6e41cf5937cd9762a8de59270a0'/>
<id>c97839a81ebbc6e41cf5937cd9762a8de59270a0</id>
<content type='text'>
test_create_... fails on a non-zero return code anyway

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
test_create_... fails on a non-zero return code anyway

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: fix the tracking_id sync test</title>
<updated>2014-04-01T07:05:53+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-04-01T06:31:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=9fa89aabba541eb47e738b98771011411aac2109'/>
<id>9fa89aabba541eb47e738b98771011411aac2109</id>
<content type='text'>
A max of num_slots -1 caused the first MT_SLOT event to be skipped, leading to
wrong tracking IDs in the slots.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A max of num_slots -1 caused the first MT_SLOT event to be skipped, leading to
wrong tracking IDs in the slots.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: shut up compiler warning</title>
<updated>2014-03-18T23:36:41+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-03-18T03:58:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=2ad8980c5a7df736d84b8acc931101d2a16ade5e'/>
<id>2ad8980c5a7df736d84b8acc931101d2a16ade5e</id>
<content type='text'>
test-libevdev-events.c: In function ‘test_double_syn_dropped_event’:
test-libevdev-events.c:187:2: warning: ignoring return value of ‘read’,
declared with attribute warn_unused_result [-Wunused-result]

This read was there to drain events even when there shouldn't be any on the
pipe anyway. So let's add an assert.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
test-libevdev-events.c: In function ‘test_double_syn_dropped_event’:
test-libevdev-events.c:187:2: warning: ignoring return value of ‘read’,
declared with attribute warn_unused_result [-Wunused-result]

This read was there to drain events even when there shouldn't be any on the
pipe anyway. So let's add an assert.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: fix distcheck</title>
<updated>2014-03-10T22:31:12+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-03-10T22:30:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=9b0d1f708ae163b3d385ea803d46e0696fbd2d36'/>
<id>9b0d1f708ae163b3d385ea803d46e0696fbd2d36</id>
<content type='text'>
Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>If the tracking ID changes during SYN_DROPPED, terminate the touch first</title>
<updated>2014-03-07T00:16:16+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2014-03-06T01:54:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=41334b5b40cd5456f5f584b55d8888aaafa1f26e'/>
<id>41334b5b40cd5456f5f584b55d8888aaafa1f26e</id>
<content type='text'>
Most clients can't deal with tracking ID changes unless a -1 is sent first. So
if we notice that the tracking ID has changed during the sync process, send a
set of ABS_MT_TRACKING_ID -1 events for each of those, then send the rest of
the events.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Most clients can't deal with tracking ID changes unless a -1 is sent first. So
if we notice that the tracking ID has changed during the sync process, send a
set of ABS_MT_TRACKING_ID -1 events for each of those, then send the rest of
the events.

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Send an extra ABS_MT_SLOT event to sync the client up with the current slot</title>
<updated>2014-03-07T00:16:11+00:00</updated>
<author>
<name>Benjamin Tissoires</name>
<email>btissoir@redhat.com</email>
</author>
<published>2014-03-05T02:03:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libevdev.git/commit/?id=d3ae3da90f871320de968924ef11ef1a02abc608'/>
<id>d3ae3da90f871320de968924ef11ef1a02abc608</id>
<content type='text'>
If multiple slots have changed during the sync handling, the client must be
re-set to the current slot before continuing with normal events.

Signed-off-by: Benjamin Tissoires &lt;btissoir@redhat.com&gt;
Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If multiple slots have changed during the sync handling, the client must be
re-set to the current slot before continuing with normal events.

Signed-off-by: Benjamin Tissoires &lt;btissoir@redhat.com&gt;
Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
Reviewed-by: Benjamin Tissoires &lt;benjamin.tissoires@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
