Commit graph

652 commits

Author SHA1 Message Date
Peter Hutterer
6292354b44 gitlab CI: remove a reference to libinput
That's what you get for copy/paste...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-14 08:38:32 +10:00
Peter Hutterer
90ff5a0cae gitlab CI: add a check-commit stage
Taken from libinput, checks for signed-off-by and other things.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-14 08:30:29 +10:00
Peter Hutterer
9fec3228fb configure.ac: add a toggle to enable the special coverity options
Coverity tries to supply system headers and fails badly at it. A bunch of
_Float... sizes are pulled in by math.h but not provided anywhere. So as a
workaround, let's add an option to explicitly enable coverity support that
simply #defines those types to ones we do know about and let's go on hoping
it'll eventually work.

See the equivalent addition to libinput in commit 8178339b5baa717.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 22:12:03 +00:00
Peter Hutterer
25cddcecd3 Add queue_push_event as shortcut for the two-liner we use everywhere
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 21:41:15 +10:00
Peter Hutterer
0af21e0e74 Simplify some error handling by assuming a >=3.4 kernel
v3.4 was released in 2012, every kernel since has that ioctl. So instead of
assuming you're running new libevdev on an 8 year old kernel, let's assume
that any error from the ioctl() is an actual error and handle it accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-11 21:07:06 +10:00
Peter Hutterer
4fc12638d2 test: slightly modernize some of the tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-11 20:57:42 +10:00
Peter Hutterer
58559d9fec test: provide a function to print an event
Easy to copy/paste into a test that needs a bit of debugging, otherwise unused.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-11 20:57:42 +10:00
Peter Hutterer
1014acedfc test: split the tests into one test case each
For debugging it's more important to be able to quickly run a single test
rather than grouping them together, we don't have thousands of tests here
anyway. So let's add a macro to put every test func into its own TCase,
allowing for test selection via the environment variable CK_RUN_CASE.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-11 20:57:42 +10:00
Peter Hutterer
2af0b94623 test: wrap the event checks into a macro
One-liner to check an event rather than three separate statements in every
test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-11 20:57:42 +10:00
Peter Hutterer
28dbb3399a doc: add markdown for monospace rendering of defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-11 20:46:14 +10:00
Michael Forney
1f1bd4e2ce Only use GCC pragma on GCC
Signed-off-by: Michael Forney <mforney@mforney.org>
2020-02-05 20:31:30 -08:00
Michael Forney
2f300eb6b5 Avoid initializer index range
This is a GNU C extension, and is not available in ISO C.

Instead, just explicitly initialize other indices to -1.

Signed-off-by: Michael Forney <mforney@mforney.org>
2020-02-05 20:31:30 -08:00
Michael Forney
06ef34c86b Add fallback min/max for compilers that don't have statement expressions
Statement expressions are a GNU C extension and are not available
in ISO C.

On compilers that don't have them, define these macros as plain
conditional expressions, since they are only ever used with expressions
that have no side-effects.

The statement-expression version is still retained as an added
safety measure on GNU-compatible compilers.

Signed-off-by: Michael Forney <mforney@mforney.org>
2020-02-05 20:30:39 -08:00
Peter Hutterer
e74ba891f7 test: add mangle_path to the excluded symbols leak list
Don't 100% know where it comes from but it's not ours, so...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-06 10:36:17 +10:00
Peter Hutterer
6668e0fe21 gitlab CI: some more centos deduplication
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-06 10:25:05 +10:00
Peter Hutterer
5b97b970c0 gitlab CI: don't run distcheck on centos 7 anymore
With b65be7aa79 the centos 7 RPMs don't include doxygen anymore, so let's drop
the distcheck job. Centos 7 is old enough at this point that we don't need to
care too much.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-06 10:22:48 +10:00
Peter Hutterer
5b3659d468 gitlab CI: force a rebuild of all the docker containers
To make sure the current pipeline is correct

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-03 20:40:40 +10:00
Peter Hutterer
ff8a5b065c gitlab CI: switch the custom builds to Fedora 31
With b65be7aa79 the centos 7 RPMs don't include doxygen anymore, causing a CI
pipeline failure (but only where the centos image is being rebuilt).

Fedora is a better early-warning system about possible breakages than Centos -
which was originally chosen precisely because it doesn't update much and was
faster to run in the CI (this was before custom docker images).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-03 20:40:40 +10:00
Peter Hutterer
925b2aa26d test: replace the SW_LID tests with SW_HEADPHONE_INSERT
We're only testing EV_SW event delivery here and SW_LID has the tendency to
suspend the host when we don't specifically inhibit it. So let's just swap for
the next one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 13:45:18 +10:00
Peter Hutterer
b65be7aa79 CI: add a Centos 8 container build
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 14:47:50 +10:00
Peter Hutterer
864f0c6829 CI: deduplicate distcheck by making it a variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 14:47:50 +10:00
Peter Hutterer
74d4a3d11d CI: move the configure flags into a variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 14:40:56 +10:00
Peter Hutterer
6c4981393e CI: extend the CI to work with containers
Mostly copy/paste from libinput but we do build on debian and centos as well.
The special builds are basically the same as before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-25 00:17:46 +00:00
Peter Hutterer
9a5f44a605 make-event-names.py should take the files as argument
Don't rely on cat, just let our script read everything as required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-23 03:13:50 +00:00
Alexander Dahl
2c6733fc67 doc: Fix function names in simple code example
That code did not compile because those functions were only renamed in
header and code back then, but not in the example.

Fixes: ab2f20bfd6 ("Revamp the API once again")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-13 15:30:57 +10:00
Peter Hutterer
779749b22c libevdev 1.8.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-26 14:35:54 +10:00
Peter Hutterer
fce16d51a8 include: sync event codes with kernel 5.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-26 14:33:19 +10:00
Nayan Deshmukh
a2bb53262f doc: add a note regarding truncation of id_* fields
The id_* fields are 16 bits in linux/input.h and we mirror
the kernel API here. Even though we accept an int for this
fields in ABI the value is truncated at 16 bits.

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-05 08:26:15 +10:00
Peter Hutterer
da67db5f59 Initialize the slots correctly when enabling ABS_MT_SLOT
Previously, enabling or disabling ABS_MT_SLOT would not change the actual
slots, it was treated as a normal bitflag. This means we couldn't initialize a
libevdev context from scratch and have it behave like a correct MT context.

Fixes #4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-18 09:31:41 +10:00
Peter Hutterer
4d745caab4 doc: fix a typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-12 08:55:42 +10:00
Peter Hutterer
1300c23792 libevdev 1.7.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 11:36:08 +10:00
Peter Hutterer
71bf23cdc4 doc: fix distcheck
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 11:15:15 +10:00
Peter Hutterer
49206a2aba doc: minor documentation updates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:56:45 +10:00
Peter Hutterer
deb52eb52f doc: add libinput's doxygen styles
Minor modifications to the style, but at least this is readable now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:56:45 +10:00
Peter Hutterer
d834a1f2b7 doc: drop the custom stylesheet
Revert back to the normal doxygen looks, even though they're pretty awful. But
at least they're consistent, the custom stylesheets had all sorts of weird
corner cases that didnt' render correctly and I don't have enough CSS
knowledge to fix this correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-03 17:48:28 +10:00
Peter Hutterer
7ea9b09433 doc: a change of the CSS needs to trigger a doxygen rebuild
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-03 17:48:28 +10:00
Peter Hutterer
a68e91b172 doc: change @retval documentation to help doxygen with rendering
This causes some weird rendering, let's split it into a list (which also
happens to be more readable).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-03 17:48:28 +10:00
Peter Hutterer
c8be2b3260 doc: fix some doxygen layout
The linewrapped 1 caused doxygen to start a list

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-03 17:48:11 +10:00
Peter Hutterer
cf645672dc doc: fix some doxygen warnings
warning: explicit link request to 'defines' could not be resolved

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-03 17:47:41 +10:00
Peter Hutterer
ae7b6128a8 libevdev 1.7rc1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-24 10:55:02 +10:00
Peter Hutterer
55d7375972 include: sync event codes with kernel 5.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-07 10:30:40 +10:00
Peter Hutterer
9fe185dd3d Add a code-based name lookup function
Two new function pairs:
	libevdev_event_code_from_code_name()
	libevdev_event_type_from_code_name()

	libevdev_event_code_from_code_name_n()
	libevdev_event_type_from_code_name_n()

These functions look up event codes/types by the name of the event code only,
removing the need to figure out what event type an event code has. So if all
you have is "BTN_TOUCH", you can now look up the type and code for that,
without having to check the prefix yourself to guess at the type.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-21 00:55:32 +00:00
Peter Hutterer
76662deeff Don't read events unless required
With the previous approach, every libevdev_next_event() invocation triggered a
read() on the device fd. This is not efficient, the kernel provides whole
event frames at a time so we're guaranteed to have more events waiting unless
the current event is a SYN_REPORT.

Assuming a fast-enough client and e.g. a touchpad device with multiple axes
per frame, we'd thus trigger several unnecessary read() calls per event frame.

Drop this behavior, instead only trigger the read when our internal queue is
empty and we need more events.

Fallout:
- we don't have any warning about a too-slow sync, i.e. if a SYN_DROPPED
  arrives while we're syncing, we don't get a warning in the log anymore.
  the test for this was removed.
- the tests that required the specific behavior were rewritten accordingly
- a revoke on a kernel device doesn't return ENODEV until already-received
  events have been processed

The above shouldn't be an issue for existing real-world clients.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-19 01:02:52 +00:00
Peter Hutterer
951cd6a189 include: sync event codes with kernel 5.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-06 10:56:55 +10:00
Peter Hutterer
6852dadbca Replace ABS_MT_SLOT - 1 with the v4.20 ABS_RESERVED define
ABS_RESERVED was added to 4.20 for that reason, to keep that event code
reserved so we can't use it for anything else (and thus mess up the fake MT
detection).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-16 13:17:33 +10:00
Peter Hutterer
29628dc2c3 include: sync event codes with kernel 4.20 2019-01-16 13:15:05 +10:00
Peter Hutterer
f293c11fec libevdev 1.6.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-26 09:50:23 +10:00
Peter Hutterer
41e47b7043 include: sync event codes with kernel 4.19
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-22 18:55:57 +10:00
Peter Hutterer
1e605f6282 Add libevdev_event_value_get_name() to resolve ABS_MT_TOOL_TYPE values
ABS_MT_TOOL_TYPE values are an enum, not a numerical value like all other
axes. So let's allow converting those values to string.

Fixes https://gitlab.freedesktop.org/libevdev/libevdev/issues/1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-07-09 11:57:57 +10:00
Peter Hutterer
d9cfd143d0 Resolve the names "SW_MAX" and friends
Some of the *_MAX names are duplicates and have a real define. These were not
resolved until now.

Fixes https://gitlab.freedesktop.org/libevdev/libevdev/issues/3

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-07-09 11:57:57 +10:00