Commit graph

626 commits

Author SHA1 Message Date
Peter Hutterer
fdf737494e Fix memory leaks when failing to create a uinput device
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>
2014-02-27 13:22:50 +10:00
Peter Hutterer
f162f00f1d Plug a memory leak for name, uniq, phys
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>
2014-02-27 13:19:36 +10:00
Peter Hutterer
05c061c2bc test: plug more memory leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-27 13:19:12 +10:00
Peter Hutterer
128cdcf105 test: fix memleak when using the test-uinput device
The libevdev-created uinput device was never freed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-27 11:08:51 +10:00
Emmanuele Bassi
84d2d5034c tools: Fix compiler warning
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-26 07:24:46 +10:00
Emmanuele Bassi
b215120e39 Fix the include directives when building in tools/
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>
2014-02-26 07:23:45 +10:00
Peter Hutterer
061927dd76 Add a test for EVIOCREVOKE
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>
2014-02-26 07:22:04 +10:00
Peter Hutterer
2c4daec150 Document that the return value of get_name|uniq|phys is not permanent
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>
2014-02-25 13:18:21 +10:00
Peter Hutterer
5250243b6f tools: add a tool to print the actual range provided by a touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-25 13:18:18 +10:00
Peter Hutterer
a5a06035f9 Replace hardcoded 0 with the enum for it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-25 13:05:33 +10:00
Peter Hutterer
f01a887b30 test: remove a bunch of superfluous empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-25 13:05:30 +10:00
Peter Hutterer
cf70d0cd88 libevdev 1.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-18 14:51:23 +10:00
Peter Hutterer
50b82c19b5 Actually filter by log priority
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>
2014-02-13 08:07:30 +10:00
Peter Hutterer
0d593bff71 Use 0 instead of "zero"
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>
2014-02-12 16:01:10 +10:00
Peter Hutterer
069236334c More documentation fixes and improvements
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-12 16:01:10 +10:00
Peter Hutterer
fd01f895b6 Mark a few more functions as signal-safe
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-12 15:47:33 +10:00
Peter Hutterer
7e8ba41a40 Improve the documentation a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-11 16:46:49 +10:00
Peter Hutterer
4b3d2405e3 Document that we don't support EVIOCREVOKE
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>
2014-02-11 16:46:49 +10:00
Peter Hutterer
2a06d3e182 README: remove the warning, it's stable now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-11 16:27:50 +10:00
Peter Hutterer
da6de93985 libevdev 0.9.1
libevdev 1.0-rc1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-29 15:09:05 +10:00
Peter Hutterer
6c2b01d67f test: remove NULL test for SW_MAX, 3.13 defines SW_MUTE_DEVICE
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-29 15:08:12 +10:00
Peter Hutterer
def04e91e7 Bump soname
Bump once to the stable interface we have now. This isn't really required as
we're compatible with everything but functions deprecated with 0.4 but we
might as well do it now to force a rebuild of everyone. Should've done that
for 0.6 when we actually dropped the function, but ...

Now that we have proper library versioning we shouldn't need any
backwards-incompatible soname bumps for a while.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-01-29 15:02:45 +10:00
David Herrmann
5f40be0b43 Add ld version-script
Explicit symbol versioning allows us to provide multiple versions of
incompatible API changes. It is a very common practice in GNU world and
avoids the problems occuring if distributions try to ship multiple version
of a single DSO.

Background information available at:
  http://people.redhat.com/drepper/dsohowto.pdf

To see the symbol-versions, use objdump:
  objdump -T libevdev/.libs/libevdev.so.1.0.0
This can also be used to verify that all symbols are correctly
exported (typos in linker-scripts are silently ignored by ld).

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

Updated for evdev 0.6's API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-29 15:02:40 +10:00
Peter Hutterer
8356f417df include: update linux/input.h for kernel 3.13
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-22 09:15:14 +10:00
Peter Hutterer
642c91fc6a Warn about a SYN_DROPPED right after finishing a sync
If the first event after a completed device sync is a SYN_DROPPED, warn the
user that they're not fast enough handling this device.

The test for this is rather complicated since we can't write SYN_DROPPED
through uinput so we have to juggle the device fd and a pipe and switch
between the two at the right time (taking into account that libevdev will read
events from the fd whenever it can).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-22 09:15:14 +10:00
Peter Hutterer
0c01886985 test: abort on unexpected log messages
Add two log functions, one that aborts on a received message. We know when we
expect to receive an error, so anytime this happens unexpectedly should
terminate the test.

And for those tests do issue a log message, let them ignore it and don't
print anything.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-22 09:14:40 +10:00
Peter Hutterer
77bf0fe228 Count the number of events needed for a full sync
Make sure we have a queue that is at least large enough to do a full sync
after a SYN_DROPPED, plus store a few extra events in case some came in after
the sync.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-01-22 08:28:41 +10:00
Peter Hutterer
4eeda3bc47 test: fix typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-17 10:54:58 +10:00
Peter Hutterer
650f372c90 test: rename a test to match what it's testing better
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-17 10:54:58 +10:00
Peter Hutterer
cea8f0b8cc Drop the argparse requirement for make-event-names.py
We only take one option (path to linux/input.h) anyway so drop the argparse
requirement. This way libevdev builds on RHEL6 too which doesn't ship
argparse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-01-15 08:01:31 +10:00
Peter Hutterer
8f2a808cfa Drop --output flag and python generation code from make-event-names.py
This is a leftover from when the file was in evemu and used to generate python
headers too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-01-15 08:00:18 +10:00
Peter Hutterer
d3c3486560 include: update linux/input.h for kernel 3.12
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-01-09 09:05:05 +10:00
Peter Hutterer
fd3118ea1a test: detect if we're running inside gdb and disable forking
The Check test framework forks by default which is annoying when running gdb.
Try to detect whether we're inside gdb by ptracing ourselves. If that works,
we're not inside a debugger. If it doesn't, then assume we're inside a
debugger and set CK_FORK to "no".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-24 09:14:12 +10:00
Peter Hutterer
49f0b9300e Documentation rewordings and additions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-24 09:14:12 +10:00
Peter Hutterer
f87647b509 Documentation typo fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-24 09:13:23 +10:00
Peter Hutterer
590291513b Add more cross-references
doxygen doesn't detect enum cross-references automatically, prefix them with
@ref

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-24 09:13:23 +10:00
Peter Hutterer
7da329b4d4 doc: remove initial * from example code lines
doxygen actually copies that over into the resulting output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-24 09:12:32 +10:00
Peter Hutterer
5c2605c039 libevdev 0.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-23 17:38:07 +10:00
Peter Hutterer
e947fdc4c7 test: add basic link test
This test doesn't do anything but compile and link against libevdev. It's a
simple protection to avoid linker errors. If we ever have libs we depend on
and they don't get resolved properly, this test should warn us in time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-12 13:19:52 +10:00
Peter Hutterer
2487950f65 test: split tests into run-time and build-time tests
The build-time tests don't do anything, we don't need to run them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-12 12:57:21 +10:00
Peter Hutterer
546efc783c Don't treat devices with (ABS_MT_SLOT - 1) as multitouch devices
Some devices (PS3 sixaxis controller) merely have a bunch of axes, without the
semantic information that linux/input.h requires. For those, the ABS_MT range
may be merely another axis, not the special range that we need to treat it
with.

Use a simple heuristic: if ABS_MT_SLOT - 1 is enabled, don't treat ABS_MT as
multitouch axes. The ABS_MT_SLOT - 1 axis is not used for a real axis.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-12-10 19:39:47 +10:00
Peter Hutterer
714c2ffa9e Merge branch 'ev-rep-handling' 2013-12-09 09:49:43 +10:00
Peter Hutterer
f66bf57baa State that the event is defined for a SYN_DROPPED
All clients that want to handle SYN_DROPPED correctly need to pass an EV_SYN
through their own handlers before starting with the syn events. Rather than
letting them synthesize that, guarantee that the event is defined the first
time LIBEVDEV_READ_STATUS_SYNC is returned.

This does not change existing behavior, it merely documents it so we can rely
on it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-09 09:49:28 +10:00
Peter Hutterer
a2f842bb8a Support EV_REP values through libevdev_get_event_value
We shouldn't have a separate API for that, the whole point of libevdev is to
abstract the quirkyness of the ioctls into a common interface. So let's
export the two EV_REP values through libevdev_get_event_value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-12-09 09:49:15 +10:00
Peter Hutterer
0aae85122d Constify libevdev_get_repeat
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-09 09:49:15 +10:00
Peter Hutterer
aac29742b0 Move the testing part to a separate page
Not something that interests the average visitor of the front page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-09 09:48:59 +10:00
Peter Hutterer
f0f4f00c2a Add a doxygen page listing the ioctls and their current support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-12-09 09:48:27 +10:00
Peter Hutterer
94628309f9 doc: add a placeholder man page
We don't provide man pages (the ones created by doxygen are pretty
terrible) so provide a placeholder page to provide the minimum info and point
people in the right direction.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-09 08:46:24 +10:00
Peter Hutterer
08a7773ef8 Documentation fix, refer to correct function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-05 07:53:12 +10:00
Peter Hutterer
14af49ab39 Fix a typo in the documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-05 07:53:10 +10:00