summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* libevdev 1.1libevdev-1.1baserock/genivi/baselinePeter Hutterer2014-03-251-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add documentation for axis updates without a tracking IDPeter Hutterer2014-03-211-0/+49
| | | | | | | | | | | If a touch starts and terminates while in SYN_DROPPED, the tracking ID appears to stay at -1, but the other axes may update. We need to pass these on to the client since the kernel may buffer the next event with the same value otherwise. Note this in the documentation so that client's don't create touch points based on out-of-touchpoint updates. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* libevdev 1.1RC2libevdev-1.0.99.2Peter Hutterer2014-03-191-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Bump library revisionPeter Hutterer2014-03-191-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* uinput: check for asprintf failurePeter Hutterer2014-03-191-1/+2
| | | | | | | | | | This doesn't really do much here, but strictly speaking: if asprintf returns -1, devnode is undefined. So reset it to NULL to avoid weird pointers. And also free the rest of the names if we ever have more than one device - which also shouldn't happen. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* test: shut up compiler warningPeter Hutterer2014-03-191-1/+1
| | | | | | | | | | | | 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 <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Shut up another warningPeter Hutterer2014-03-191-1/+1
| | | | | | | | | | | Triggered with -O3 ../libevdev/libevdev.c: In function ‘libevdev_get_event_value’: ../libevdev/libevdev.c:1112:6: warning: ‘value’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Shut up compiler warningPeter Hutterer2014-03-191-1/+1
| | | | | | | | | | | | | | Triggered with -O ../libevdev/libevdev.c: In function ‘libevdev_has_event_code’: ../libevdev/libevdev-util.h:58:20: warning: ‘mask’ may be used uninitialized in this function [-Wmaybe-uninitialized] Optimisation clearly shuffles things around here: in the code, if no max is found, we return -1 and bail out before we access mask. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Sanitize events when we're skipping sync as wellPeter Hutterer2014-03-191-0/+1
| | | | | | | | If a client doesn't sync expliciltly, make sure we sanitize the events when we update the internal library state. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* add a linebreak for correct rendering of the documentationPeter Hutterer2014-03-181-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: move the section for the internal test suite downPeter Hutterer2014-03-141-46/+46
| | | | | | | | | "Related Pages" in doxygen are ordered in the order they appear in the source file. The internal test suite is least likely to be of interest to the reader, so move it to the bottom. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* doc: include linux/input.h verbatim in the documentationPeter Hutterer2014-03-142-1/+10
| | | | | | | | This makes it easier to look up what specific version libevdev was compiled against. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* doc: Add documentation on how SYN_DROPPED is handledPeter Hutterer2014-03-141-2/+158
| | | | | | | | This is getting a bit complex, so add some high-level documentation that we at least know what we're trying to do. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* configure: add link to our wiki pagePeter Hutterer2014-03-111-1/+1
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* libevdev 1.1RC1libevdev-1.0.99.1Peter Hutterer2014-03-111-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: fix distcheckPeter Hutterer2014-03-111-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add a documentation note to update the slot after syncingPeter Hutterer2014-03-071-1/+5
| | | | | | | | | | Clients may not care about the events generated during SYN_DROPPED, but the current slot must be updated to avoid a client being out-of-date. Same with tracking IDs, if they changed, the caller will likely have to update some internal states. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* If the tracking ID changes during SYN_DROPPED, terminate the touch firstPeter Hutterer2014-03-072-0/+189
| | | | | | | | | | 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 <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Send an extra ABS_MT_SLOT event to sync the client up with the current slotBenjamin Tissoires2014-03-072-2/+116
| | | | | | | | | 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 <btissoir@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Don't sync the MT state for fake MT devicesPeter Hutterer2014-03-063-2/+91
| | | | | | | | | | | | | Devices with ABS_MT_SLOT-1 are fake MT devices, they merely overlap the axis range but don't actually provide slots. The EVIOCGABS ioctl won't work to retrieve the current value - the kernel does not store values for those axes and the return value is always 0. Thus, simply ignore those axes for fake MT devices and instead rely on the next event to update the caller with the correct state for each axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Move some functions/macros between libevdev-int.h and libevdev-util.hPeter Hutterer2014-03-062-72/+73
| | | | | | | | This allows libevdev-util.h to be used by tests, it no longer relies on libevdev internal structs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Cap slot values to the announced maximumPeter Hutterer2014-03-063-1/+108
| | | | | | | | | | | | | | A malicious device may announce N slots but then send a slot index >= N. The slot state is almost always allocated (definitely the case in libevdev and true for most callers), so providing a slot number higher than the announced maximum is likely to lead to invalid dereferences. Don't allow that. Likewise, don't allow negative slot numbers. Note that the kernel filters these events anyway, the only way to trigger this is to change the device fd to something outside the kernel's control. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* test: add two more checks for the current slotPeter Hutterer2014-03-061-0/+3
| | | | | | | When syncing, we expect the slot to stay the same until the client has processed the events. This already worked, just add a check to make sure. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Increase MAX_SLOTS to 60Peter Hutterer2014-03-063-3/+3
| | | | | | | | | As seen on 3M devices, which seems to be the maximum seen so far. Some Stantum devices report 255 touches but are only capable of 10, so the are not affected by our limits. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* test: add a test for > MAX_SLOTS mt valuesPeter Hutterer2014-03-061-0/+102
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Reduce memory requirement for MT syncingPeter Hutterer2014-03-061-29/+39
| | | | | | | | | | | | | | | | | | | | | | | Changes the algorithm: before we'd ioctl all axes for all slots, then generate events for all slots one-by-one. Now we ioctl the slot state for each axis, copy the new event value into the device and mark a bitfield that we've updated the value. Then loop through the slots and generate events where changed. Side-effect: this makes it easy to check if anything in the slot has updated, so we can skip empty slot events during sync. Min memory requirement for the state storage was: MAX_SLOTS * (ABS_MT_CNT + 1) * sizeof(int) = 1980 Min memory requirement now: (ABS_MT_CNT + 1) * sizeof(int) + NLONGS((MAX_SLOTS * ABS_MT_CNT) bits) = 544 This is sigsafe code, so this was stack memory. Reducing the requirement allows us to up MAX_SLOTS in the future if we need to. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Dynamically allocate the slot valuesPeter Hutterer2014-03-062-11/+32
| | | | | | | | Instead of relying on a static MAX_SLOTS array, allocated it based on the number of slots we have on the device. The previous checks for MAX_SLOTS were incomplete, causing out-of-bound reads. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't sync past MAX_SLOTS slotsPeter Hutterer2014-03-062-1/+5
| | | | | | | | | | If a device has more than MAX_SLOTS slots, we'd run out-of-bounds on the sync array. This function is sig-safe, so we can't alloc here, merely limit the access. Reported-by: Jonas Ådahl <jadahl@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Add unlikely() macroPeter Hutterer2014-03-061-0/+2
| | | | | | | Taken from systemd. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* Fix a wrong reference in the libevdev_next_event documentationPeter Hutterer2014-03-061-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Document the FORCE_SYNC behavior a bit betterPeter Hutterer2014-03-051-0/+7
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: whitespace fixes (newlines)Peter Hutterer2014-03-054-7/+5
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix memory leaks when failing to create a uinput devicePeter Hutterer2014-02-271-13/+4
| | | | | | | | | | For an invalid fd, or a failure to open the device, the pre-allocated uinput device struct would leak. We can drop the open_uinput() function now, since skipping to the error handling means we'll return -errno anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Plug a memory leak for name, uniq, physPeter Hutterer2014-02-271-1/+4
| | | | | | | | | | If a device is assigned a name, uniq and/or phys before calling libevdev_set_fd(), those values would leak. Change the default alloc to calloc, so name, uniq, and phys are initialized to zero before we call libevdev_reset Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: plug more memory leaksPeter Hutterer2014-02-272-0/+4
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: fix memleak when using the test-uinput devicePeter Hutterer2014-02-271-0/+1
| | | | | | The libevdev-created uinput device was never freed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: Fix compiler warningEmmanuele Bassi2014-02-261-1/+1
| | | | | Signed-off-by: Emmanuele Bassi <ebassi@gnome.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix the include directives when building in tools/Emmanuele Bassi2014-02-261-1/+1
| | | | | | | | We need to add top_srcdir to fix the build when srcdir != builddir. Signed-off-by: Emmanuele Bassi <ebassi@gnome.org> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add a test for EVIOCREVOKEPeter Hutterer2014-02-263-1/+199
| | | | | | | | | | | New in 3.12, EVIOCREVOKE revokes access to an evdev device. This is unlikely to be used by a libevdev user, see. http://lists.freedesktop.org/archives/input-tools/2014-January/000688.html This patch adds a new test-kernel binary that tests the kernel API directly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Document that the return value of get_name|uniq|phys is not permanentPeter Hutterer2014-02-251-0/+24
| | | | | | | It's a pointer to the copy libevdev has, but that copy may be freed by the caller if someone calls e.g. libevdev_set_name() Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: add a tool to print the actual range provided by a touchpadPeter Hutterer2014-02-253-0/+201
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Replace hardcoded 0 with the enum for itPeter Hutterer2014-02-251-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: remove a bunch of superfluous empty linesPeter Hutterer2014-02-251-3/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* libevdev 1.0libevdev-1.0Peter Hutterer2014-02-181-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Actually filter by log priorityPeter Hutterer2014-02-132-1/+77
| | | | | | | | If a message is higher than the current priority, filter it. And add a few tests that the priority is handled the way it should. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Use 0 instead of "zero"Peter Hutterer2014-02-121-7/+7
| | | | | | | | We're a bit inconsistent here anyway because of the ample use of "non-zero" which can't really be converted to non-0. But let's at least be consistent with the use of 0 instead of zero. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* More documentation fixes and improvementsPeter Hutterer2014-02-122-31/+58
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Mark a few more functions as signal-safePeter Hutterer2014-02-121-0/+14
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Improve the documentation a bitPeter Hutterer2014-02-111-11/+24
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Document that we don't support EVIOCREVOKEPeter Hutterer2014-02-111-0/+3
| | | | | | | This is intentional, see http://lists.freedesktop.org/archives/input-tools/2014-January/000688.html Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>