summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* libevdev 0.4.1libevdev-0.4.1libevdev-0.4-branchPeter Hutterer2013-11-011-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Reset the struct on set_fdPeter Hutterer2013-11-011-6/+18
| | | | | | | | | | | | libevdev_set_fd may fail at a number of points. If it does, it errors out but does nothing otherwise. Thus, a client may call set_fd again for the same struct but on a different fd and have it succeed. Depending on when set_fd bailed out the first time, some fields may already be set. Thus, reset the whole struct at set_fd time to make sure we're nulled out appropriately. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> (cherry picked from commit b15e5987b35b61ca6ca447f37c5bc759523b118b)
* Check max to see if an event type is validPeter Hutterer2013-11-012-2/+20
| | | | | | | | | There's a gap in the range between EV_SW and EV_LED. Trying to enable one of those bits will segfault. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> (cherry picked from commit c4111f717a404ef5a726aa2dd420daa654455af5)
* Mark three deprecated functions as suchPeter Hutterer2013-11-013-21/+21
| | | | | | | | These are deprecated, but were missing the deprecated attribute. And fix up the tests that were still using those deprecated calls. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit d9fcbd563a1912ec4e2ba974c2731a5b4ae65dfa)
* Disable gcov by defaultPeter Hutterer2013-11-011-2/+2
| | | | | | | | | | | | | Having libevdev build with profiling enabled by default leaves profiling files around. Profiling is something that only libevdev developers should need, so let them enable it case-by-case. https://bugzilla.redhat.com/show_bug.cgi?id=1012180 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> (cherry picked from commit c8b5f6a08f2e0c5043293508fcf8ad0440b9d4ca)
* Avoid shipping generated documentation twiceStephen Kitt2013-11-011-1/+1
| | | | | | | | | | Only add files to EXTRA_DIST, to avoid having a full copy of doc/html as doc/html/html in the distributed tarball. Signed-off-by: Stephen Kitt <skitt@debian.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 92b03c9da1660ff125c49eb1c17121e077a8584e)
* Add extern C guards to libevdev-uinput.hPeter Hutterer2013-11-011-0/+7
| | | | | | Reported-by: Stanisław Halik <sthalik@misaki.pl> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit c365d22b7005dc1ccd65653d826d027201316047)
* libevdev 0.4libevdev-0.4Peter Hutterer2013-09-181-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Print an error on an invalid log priorityPeter Hutterer2013-09-181-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Merge branch 'clockid'Peter Hutterer2013-09-185-0/+142
|\
| * wrap EVIOCSCLOCKID into an API callPeter Hutterer2013-09-133-0/+135
| | | | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * test: provide wrapper for fetching the devnode from a uinput test devicePeter Hutterer2013-09-132-0/+7
| | | | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* | tools: make to function calls staticPeter Hutterer2013-09-171-2/+4
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Fix a typo in the uinput documentationPeter Hutterer2013-09-171-2/+2
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Move libevdev_led_value documentation to the kernel groupPeter Hutterer2013-09-171-0/+3
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | tools: Honor GCC_CFLAGSColin Walters2013-09-171-1/+1
| | | | | | | | | | | | | | So we get compiler warnings from tools/ too. Signed-off-by: Colin Walters <walters@verbum.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Drop duplicate compiler flagPeter Hutterer2013-09-161-1/+0
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Revert "Reintroduce -fstack-protector"Peter Hutterer2013-09-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://lists.freedesktop.org/archives/input-tools/2013-September/000332.html See above a detailed reasoning, but Colin Walters put it this way: "At a high level, I think components (git repositories) should feel free to set up default warning flags and possibly use a targeted subset of -Werror=foo. But please don't inject non-warning flags like this unless there is a very good reason. The right way to do -fstack-protector is to have something like redhat-rpm-config or other global CFLAGS system controlling *all* components." Thus, reverting the -fstack-protector flag. This doesn't completely address Colin's comments, we still use a few other flags. But this one is the one that causes real headaches, so drop it. This reverts commit f5e65ea3ce2541fe8ccfafe9b0dd04325da75b34.
* | Reintroduce -fstack-protectorDavid Herrmann2013-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We removed this previously due to build failures in: commit 14ac764ec86452ca607403f314b0f8355d80290c Author: David Herrmann <dh.herrmann@gmail.com> Date: Mon Sep 9 16:03:41 2013 +0200 build: remove -fstack-protector Reintroduce it but this time disable it if it's not supported. We use the CC-flags testing to prevent build-failures on gcc without libssp support. Cc: Giovanni Campagna <gcampagn@redhat.com> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Test for CFLAGS/LFLAGS availabilityDavid Herrmann2013-09-132-5/+313
|/ | | | | | | | | | | Use the CC_CHECK_FLAGS_APPEND() m4 macro to test for availability of CFLAGS and LFLAGS. It automatically drops the unavailable flags. This is also used by systemd, so it ought to work with ostree and other non-standard build-environments. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: add a test for checking log data being passed around correctlyPeter Hutterer2013-09-121-0/+38
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix a comment to reflect the new APIPeter Hutterer2013-09-121-3/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove warning comment from FORCE_SYNCPeter Hutterer2013-09-111-3/+2
| | | | | | | | | | | | | | There is a legitimate reason for clients to force a sync on the device. X.Org drivers lose the fd when the device is disabled and re-enabled. When the device comes back, a simple libevdev_change_fd() doesn't update the status on the device. Button states, etc. may have changed, etc. So a driver may call FORCE_SYNC after re-connecting to the fd to make sure the library and the driver get the current state of the device. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Name-space the read flags betterPeter Hutterer2013-09-117-83/+95
| | | | | | | | Rename from LIBEVDEV_READ_foo to LIBEVDEV_READ_FLAG_foo to differentiate better from LIBEVDEV_READ_STATUS_foo. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Enumerate libevdev_next_event() return codesPeter Hutterer2013-09-114-66/+89
| | | | | | | | | | | | | | | | Improved readability in callers, changing magic numbers 0 and 1 to rc = libevdev_next_event(); if (rc == LIBEVDEV_READ_STATUS_SUCCESS) do_something(); else if (rc == LIBEVDEV_READ_STATUS_SYNC) do_something_else() No ABI changes, the enum values are the previously documented values, this is just a readability improvement. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Require check 0.9.9Peter Hutterer2013-09-111-1/+1
| | | | | | | | | | 0.9.9 is the first released version with fixed ck_assert_* macros that don't do multiple expansion. http://sourceforge.net/p/check/code/596/ Reported-by: Martin Minarik <minarik11@student.fiit.stuba.sk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix comment typoPeter Hutterer2013-09-111-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: don't show enum values in doxygenPeter Hutterer2013-09-111-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add missing group assignment to a bunch of functions and enumerationsPeter Hutterer2013-09-111-6/+26
| | | | | | Without these, they won't show up in the documentation. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Revamp the API once againPeter Hutterer2013-09-109-112/+166
| | | | | | | | | | | | | | | | | Another look at the current API showed some inconsistencies, rectified in this commit: libevdev_kernel_*: modify the underlying kernel device libevdev_event_type_*: something with an event type libevdev_event_code_*: something with an event code libevdev_event_*: struct input_event-related functions (i.e. not device-related) libevdev_property_*: something with a property libevdev_*: anything applying to a device Hopefully that's the last API change. Current symbols deprecated and aliased. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* build: remove -fstack-protectorDavid Herrmann2013-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | If gcc is built without libssp support, it loudly fails linking due to missing __stack_chk_*() helpers. Unfortunately, gcc isn't smart enough to disable it automatically. systemd recently got a CC_CHECK_FLAG_APPEND helper to work around such issues: http://cgit.freedesktop.org/systemd/systemd/tree/m4/attributes.m4 I didn't want to add it now, so let's just drop -fstack-protector. If we want it, we can try adding it later again. This partially reverts: commit 43752ec17d09b132621a86f5cbc546ca6ab9e977 Author: David Herrmann <dh.herrmann@gmail.com> Date: Sun Sep 1 17:45:04 2013 +0200 Add some gcc/ld optimizations and magic All other gcc/ld options are kept. Reported-by: Giovanni Campagna <gcampagn@redhat.com> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* configure: add missing commaGiovanni Campagna2013-09-101-1/+1
| | | | | | | | | Without that, it becomes impossible to build without gcov. Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Support GNOME Build APIGiovanni Campagna2013-09-101-0/+13
| | | | | | | | | By adding an autogen.sh file with NOCONFIGURE support. Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Merge branch 'logging-fix'Peter Hutterer2013-09-107-52/+217
|\
| * test: test for logging functionPeter Hutterer2013-09-101-8/+21
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
| * Log to stderr by defaultPeter Hutterer2013-09-102-5/+29
| | | | | | | | | | | | | | | | | | The logging we do use atm inside the library is largely to spot application errors. Log that to stderr by default so it doesn't get lost. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * Warn if there are multiple devices with the same syspathPeter Hutterer2013-09-031-5/+10
| | | | | | | | | | | | | | | | | | Change to the previous code in that we continue looking at devices even after we've found one. However, this way we can warn the user when we can't guarantee syspath correctness. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * Log a few errors, specifically application bugsPeter Hutterer2013-09-032-10/+31
| | | | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * Drop per-device logging function, use per-library one insteadPeter Hutterer2013-09-034-23/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no need to have separate logging function for each device created. More likely, libevdev will be hooked up once into the logging system and expected to deal with it. Plus, this allows us to log from the uinput code where we don't have the context anyway. Requires a rename to libevdev_set_log_function to avoid ABI breaks, and while we're breaking the ABI make the logging function more sophisticated to log line, number, etc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * uinput: don't try to set the syspath twicePeter Hutterer2013-08-311-0/+1
| | | | | | | | | | | | | | | | If we have it, stop searching for it. Otherwise a second device with the same name would overwrite the first, causing a leak. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * Return -EBADF for functions that need the fd initializedPeter Hutterer2013-08-311-0/+9
| | | | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * Return EBADF when trying to read from an uninitalized devicePeter Hutterer2013-08-311-1/+1
| | | | | | | | | | | | | | | | All other functions that check the fd for validity return EBADF, which also makes it easier to debug if the actual device goes away. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
| * Use ENOMEM instead of ENOSPCPeter Hutterer2013-08-315-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | From errno(3): ENOMEM Not enough space (POSIX.1) ENOSPC No space left on device (POSIX.1) when we run out memory the reason is a failed malloc, for which ENOMEM seems more appropriate. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* | Fix comment typoPeter Hutterer2013-09-041-1/+1
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Match the kernel define for SYN_MAXPeter Hutterer2013-09-042-11/+3
| | | | | | | | | | | | | | | | | | Will be defined as 0xf in 3.12, see http://git.kernel.org/cgit/linux/kernel/git/dtor/input.git/commit/?h=next&id=52764fed5049655926bcecaefd52f0a415ceb105 And add the required ifdef guards for kernels before that. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Check for GNU ld and use the flags depending on the outcomePeter Hutterer2013-09-042-4/+6
| | | | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* | Remove -g from default GCC_CFLAGSDavid Herrmann2013-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | -g should be set by debugging-options or in the default CFLAGS="", we shouldn't force it in GCC_CFLAGS. Reported-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | Add some gcc/ld optimizations and magicDavid Herrmann2013-09-032-2/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several gcc/ld flags that optimize size and performance without requiring explicit code changes. In no particular order, this adds: - gcc -pipe to avoid temporary files and use pipes during compilation - gcc -fno-common avoids putting uninitialized global variables not marked as "extern" into a common section. This catches compilation errors if we didn't mark global variables explicitly as "extern". - gcc -fno-strict-aliasing allows us to use unions for some binary magic. Otherwise, -O2 might assume that two different types never point at the same memory. We currently don't rely on this but it's common practice so avoid any non-obvious runtime errors later. - gcc -ffunction-sections and -fdata-sections put each function and variable into a separate section. This enables ld's --gc-sections to drop any unused sections (sections which aren't referenced from an exported section). This is very useful to avoid putting dead code into DSOs. We can now link any helper function into libevdev and the linker removes all of them if they're unused. - gcc -fstack-protector adds small stack-corruption protectors in functions which have big buffers on the stack (>8bytes). If the stack-protectors are corrupted, the process is aborted. This is highly useful to debug stack-corruption issues which often are nearly impossible to catch without this. - ld --as-needed drops all linked libraries that are not actually required by libevdev. So we can link to whatever we want and the linker will drop everything which is not actually used. - ld -z now, resolve symbols during linking, not during runtime. - ld -z relro, add relocation-read-only section. This allows to put read-only global variables and alike into a read-only section. This is useful for variables that need a relocation and thus cannot be explicitly put into a read-only section. This option tells the linker to mark them read-only after relocations are done. (that's why -z now makes sense in combination with this) All of these options are common in other open-source projects, including systemd and weston. Don't ask me why they are not marked as default.. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: update to test for the various _MAX valuesPeter Hutterer2013-08-312-2/+35
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* memcpy instead of invidual bittogglePeter Hutterer2013-08-311-6/+9
| | | | | | | | | | | | | | | | The ioctls return the number of bytes copied into the destination, so just copy them into the device state instead of individually flipping bits. For easier review: rc is the return value of the EVIOCG* ioctl, which is the number of bytes copied. state variables must be initialized to 0 now, in case the kernel's FOO_MAX is smaller than libevdev's FOO_MAX. If not initialized to 0, the bytes between the two max values is undefined and we may end up generating bogus events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>