Commit graph

626 commits

Author SHA1 Message Date
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
Peter Hutterer
812fc7096d make-event-names: minor cleanups for readability
Two variable renames for less ambiguity
Two changes from an long if condition to a "if foo in [...]"

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
35d6ce09d8 test: add a test timeout multiplier for valgrind
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-09 11:57:57 +10:00
Peter Hutterer
6a1f2e2ed2 GitLab CI: actually reference the default artifacts
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-09 11:14:14 +10:00
Peter Hutterer
a2ac0f0889 GitLab CI: build with the various options
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-29 12:07:14 +10:00
Peter Hutterer
ad5142a1b3 Add GitLab CI
A simple version of it, we just pull down a few popular distros, build on them
and make sure distcheck passes.

https://gitlab.freedesktop.org/libevdev/libevdev/issues/2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-29 12:07:10 +10:00
Peter Hutterer
c16d85b8b6 configure.ac: remove --disable-test-run
This flag was used to disable test runs during make distcheck. Now that we
have more checks and the environment variable, we can drop this flag.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-29 11:50:38 +10:00
Peter Hutterer
6345c1cca2 configure.ac: fix the gcov linker flags
Presumably this worked, but it certainly doesn't work anymore (neither on
RHEL7 nor on Fedora 28)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-29 11:50:37 +10:00
Peter Hutterer
e4c3a8ee7a test: add LIBEVDEV_SKIP_ROOT_TESTS environment variable check
Depending on the container, or other checks don't always work. Add an extra
environment variable instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-29 11:15:41 +10:00
Peter Hutterer
c4cfd7668a test: move the kernel test to the same infrastructure
We previously had this separate because it tested separate things. Now the
setup is generic enough that we should just re-use it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 15:19:05 +10:00
Peter Hutterer
1f9e087dac test: check for the device nodes to exist before testing
Even if we're root we may be running in a container without input device
nodes. In which case we should skip the test, not fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 15:19:05 +10:00
Peter Hutterer
805706a816 test: split some non-root tests into separate binaries
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 15:01:59 +10:00
Peter Hutterer
b642eddc31 test: sort-of autodetect whether we need root privileges
It's not really autodetection, we just declare the test suites that need root
privs. But this way we can generically check for it from the main() that we
re-use across tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 15:01:19 +10:00
Peter Hutterer
83ce8eb5be test: automate test suite handling
Move all tests to a special section, then loop through that section
to fetch all test suite. The result is that new tests only need to add the
source files without having to update everything else as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 15:00:24 +10:00
Peter Hutterer
bc5c72571d test: rename some tests for less ambiguity
"key" usually refers to one of KEY_ of EV_KEY in general, but here we're
testing event codes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-15 14:16:29 +10:00
Peter Hutterer
c3953e1bb8 Change all URLs to gitlab.fdo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-06 18:20:11 +10:00
Deepa Dinamani
3c6766c862 Update struct input_event
The struct input_event is not y2038 safe.
Update the struct according to the kernel patch:
https://lkml.org/lkml/2018/1/6/324

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-12 15:23:22 +10:00
Peter Hutterer
501f739564 include: sync event codes with kernel 4.16
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-04 10:54:43 +10:00
Peter Hutterer
7ae667ee89 libevdev 1.5.9
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-08 15:25:28 +10:00
Peter Hutterer
fbeeef9cde test: skip tests when we're not root
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-02-26 17:12:08 +10:00
Peter Hutterer
6ff816163e Blacklist SW_MAX so it doesn't shadow SW_PEN_INSERTED
They have the same value, so the _MAX code would shadow the real code, causing
issues in any client that needs to get all event names from libevdev.
Specifically, the loop of:
  for each code in 0 to max-for-type:
      print(name)
would not show up the code (but the _MAX) code instead. This causes issues
with clients that rely on name resolution that works. And the _MAX values are
special values anyway.

Blacklist it in the script here, causing it to resolve from name to code, but
not from code to name (like other duplicated codes).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-02-26 17:12:08 +10:00
Peter Hutterer
a67d1964ff Blacklist REP_MAX so it doesn't shadow REP_PERIOD
They have the same value, so the _MAX code would shadow the real code, causing
issues in any client that needs to get all event names from libevdev.
Specifically, the loop of:
  for each code in 0 to max-for-type:
      print(name)
would not show up the code (but the _MAX) code instead. This causes issues
with clients that rely on name resolution that works. And the _MAX values are
special values anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-02-26 17:12:08 +10:00
Peter Hutterer
3799acd49e Drop the python map printing
leftover from when this was part of evemu

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-02-26 16:53:55 +10:00
Peter Hutterer
0f40ad8888 libevdev 1.5.8
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-29 14:17:50 +10:00
Peter Hutterer
8df02686d3 Sync with kernel 4.15 (BTN_STYLUS3)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-29 14:13:58 +10:00
Peter Hutterer
e84897f29a test: add --no-install flag to be able to debug directly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-13 10:01:58 +10:00
Peter Hutterer
0637d0237a When changing the fd, reset our grab state to ungrabbed
Previously, calling grabbing a device after changing the fd was a no-op
because libevdev's grab state didn't match the fd:

libevdev_grab(LIBEVDEV_GRAB);
  .. fd is grabbed
  .. internal state is 'grabbed'
libevdev_change_fd();
  .. new fd is ungrabbed
  .. internal state is 'grabbed'
libevdev_grab(LIBEVDEV_GRAB);
  .. argument matches internal state and we exit without grabbing the device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-13 10:01:58 +10:00