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>
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>
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>
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>
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 f5e65ea3ce.
We removed this previously due to build failures in:
commit 14ac764ec8
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>
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>
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>
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>
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>
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>
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>
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 43752ec17d
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>
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>
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>
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>
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>
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>
-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>
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>
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>
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>
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>