summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-09-18libevdev 0.4libevdev-0.4Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-18Print an error on an invalid log priorityPeter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-18Merge branch 'clockid'Peter Hutterer5-0/+142
2013-09-17tools: make to function calls staticPeter Hutterer1-2/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-17Fix a typo in the uinput documentationPeter Hutterer1-2/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-17Move libevdev_led_value documentation to the kernel groupPeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-17tools: Honor GCC_CFLAGSColin Walters1-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>
2013-09-16Drop duplicate compiler flagPeter Hutterer1-1/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-16Revert "Reintroduce -fstack-protector"Peter Hutterer1-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.
2013-09-13Reintroduce -fstack-protectorDavid Herrmann1-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>
2013-09-13Test for CFLAGS/LFLAGS availabilityDavid Herrmann2-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>
2013-09-13wrap EVIOCSCLOCKID into an API callPeter Hutterer3-0/+135
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-09-13test: provide wrapper for fetching the devnode from a uinput test devicePeter Hutterer2-0/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-09-12test: add a test for checking log data being passed around correctlyPeter Hutterer1-0/+38
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-12Fix a comment to reflect the new APIPeter Hutterer1-3/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-11Remove warning comment from FORCE_SYNCPeter Hutterer1-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>
2013-09-11Name-space the read flags betterPeter Hutterer7-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>
2013-09-11Enumerate libevdev_next_event() return codesPeter Hutterer4-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>
2013-09-11Require check 0.9.9Peter Hutterer1-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>
2013-09-11Fix comment typoPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-11doc: don't show enum values in doxygenPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-11Add missing group assignment to a bunch of functions and enumerationsPeter Hutterer1-6/+26
Without these, they won't show up in the documentation. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-10Revamp the API once againPeter Hutterer9-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>
2013-09-10build: remove -fstack-protectorDavid Herrmann1-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>
2013-09-10configure: add missing commaGiovanni Campagna1-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>
2013-09-10Support GNOME Build APIGiovanni Campagna1-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>
2013-09-10Merge branch 'logging-fix'Peter Hutterer7-52/+217
2013-09-10test: test for logging functionPeter Hutterer1-8/+21
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-10Log to stderr by defaultPeter Hutterer2-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>
2013-09-04Fix comment typoPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-09-04Match the kernel define for SYN_MAXPeter Hutterer2-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>
2013-09-04Check for GNU ld and use the flags depending on the outcomePeter Hutterer2-4/+6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-09-03Warn if there are multiple devices with the same syspathPeter Hutterer1-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>
2013-09-03Log a few errors, specifically application bugsPeter Hutterer2-10/+31
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-09-03Drop per-device logging function, use per-library one insteadPeter Hutterer4-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>
2013-09-03Remove -g from default GCC_CFLAGSDavid Herrmann1-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>
2013-09-03Add some gcc/ld optimizations and magicDavid Herrmann2-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>
2013-08-31uinput: don't try to set the syspath twicePeter Hutterer1-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>
2013-08-31Return -EBADF for functions that need the fd initializedPeter Hutterer1-0/+9
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-31Return EBADF when trying to read from an uninitalized devicePeter Hutterer1-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>
2013-08-31Use ENOMEM instead of ENOSPCPeter Hutterer5-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>
2013-08-31test: update to test for the various _MAX valuesPeter Hutterer2-2/+35
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-31memcpy instead of invidual bittogglePeter Hutterer1-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>
2013-08-30test: add a test for uinput device propertiesPeter Hutterer1-0/+46
Specifically, test for INPUT_PROP_MAX, which is a valid property value Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-30Fix off-by-one errors when dealing with *_MAX values.Peter Hutterer6-14/+14
LED_MAX, KEY_MAX, ABS_MT_MAX, etc. are all valid event codes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-29Use AC_USE_SYSTEM_EXTENSIONSPeter Hutterer5-4/+1
Defines _GNU_SOURCE for us. http://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Posix-Variants.html Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-29test: fix ev_rep test for new uinput implementationPeter Hutterer1-4/+27
We can actually set EV_REP values now, though with limitations Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-29test: switch udev backend over to new libevdev-uinput bitsPeter Hutterer3-223/+44
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-29test: add uinput creation testsPeter Hutterer3-0/+348
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-29Add support for uinput device creationPeter Hutterer6-3/+632
This lets libevdev provide a relatively generic interface for the creation of uinput devices so we don't need to duplicate this across multiple projects. Most of this is lifted from the current test implementation, with a couple of minor changes. EV_REP needs special handling: Kernel allows to set the EV_REP bit, it doesn't set REP_* bits (which we wrap anyway) but it will also set the default values (500, 33). Device node is guessed based on the sysfs path: The sysfs path contains a eventN file, that corresponds to our /dev/input/eventN number. Use it so clients can quickly get the device node, without a libudev dependency. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>