Commit graph

27 commits

Author SHA1 Message Date
Peter Hutterer
60d4f1b2ae Change to the (always intended) MIT license
Due to what must've been a copy/paste error many years ago, the license text
for libevdev wasn't actually the MIT license. Let's rectify this, it was
always MIT intended anyway.

To make this more obvious and reduce the chance of copy/paste mistakes, use
the SPDX license identifier in the various source files. The two installed
public header files have the full license text.

All contributors with copyrightable contributions have ACKed the license
change to MIT, either in the MR directly [1] or privately in reply to an
email.

[1] https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/69

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Alexander Dahl <ada@thorsis.com>
Acked-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Acked-by: Armin K <krejzi@email.com>
Acked-by: Benjamin Tissoires <btissoir@redhat.com>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Emmanuele Bassi <ebassi@gnome.org>
Acked-by: Gaetan Nadon <memsize@videotron.ca>
Acked-by: George Thomas <georgefsthomas@gmail.com>
Acked-by: Michael Forney <mforney@mforney.org>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Acked-by: Niclas Zeising <zeising@daemonic.se>
Acked-by: Owen W. Taylor <otaylor@fishsoup.net>
Acked-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Ran Benita <ran234@gmail.com>
Acked-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Scott Jann <sjann@knight-rider.org>
Acked-by: Thilo Schulz <thilo@tjps.eu>
Acked-by: polyphemus <rolfmorel@gmail.com>
2021-01-25 13:46:55 +10:00
Peter Hutterer
44b5c9bd9f include: sync event codes with kernel 5.8
And fix the script to sync the headers up so it syncs event codes for both bsd
and linux, but only syncs input.h for linux.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-11 12:13:13 +10:00
Peter Hutterer
66113fe84f libevdev: any value less than 0 has a NULL name
Fixes https://gitlab.freedesktop.org/libevdev/libevdev/-/issues/15

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 13:36:18 +10:00
Peter Hutterer
4c8a7a265d config.h is a local include path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-14 12:03:23 +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
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
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
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
4160d94baf cosmetic: fix a couple of duplicate/missing empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-04 08:41:33 +10:00
Peter Hutterer
6c2b01d67f test: remove NULL test for SW_MAX, 3.13 defines SW_MUTE_DEVICE
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-29 15:08:12 +10:00
Peter Hutterer
d3c3486560 include: update linux/input.h for kernel 3.12
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2014-01-09 09:05:05 +10:00
Peter Hutterer
2a3219f55d Add a copy of linux/input.h
This avoids a number of otherwise required ifdefs when building on older kernels

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-23 09:04:34 +10:00
Peter Hutterer
d9fcbd563a Mark three deprecated functions as such
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>
2013-10-04 16:02:22 +10:00
Peter Hutterer
ab2f20bfd6 Revamp the API once again
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-10 11:25:09 +10:00
Peter Hutterer
75b66c1fb5 Match the kernel define for SYN_MAX
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-04 07:54:22 +10:00
Peter Hutterer
b77fea9c89 Fix off-by-one errors when dealing with *_MAX values.
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-30 17:40:54 +10:00
Peter Hutterer
dd4a1a49de test: add test for libevdev_is_event_code(EV_SYN...)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-29 11:36:20 +10:00
Martin Minarik
411031178e Fix build without MSC_TIMESTAMP
To build with older input.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-26 08:10:11 +10:00
Peter Hutterer
00528f27d5 Rename a few getters for consistency
Deprecated:
* libevdev_get_abs_min, libevdev_get_abs_max
* libevdev_get_input_prop_name

Will be removed in one or two versions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-08-01 13:53:05 +10:00
Peter Hutterer
b17ba48458 test: add test for event values (type and code)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-04 11:11:51 +10:00
Peter Hutterer
07910f8bf4 test: unify test case creation in test-event-names.c
Simple rename from custom test case variable names to tc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-04 11:05:39 +10:00
Peter Hutterer
a30f4cfa8a test: prepare a common header file for all tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-06-29 18:00:42 +10:00
Peter Hutterer
d14626989d test: test some more event max and invalid event type paths
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-06-27 10:41:55 +10:00
Peter Hutterer
9e81874c49 Pull all tests together into one binary
Easier to monitor gcov coverage that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-06-27 10:41:54 +10:00
Peter Hutterer
7c860d6002 Set up a test harness
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-06-04 11:39:33 +10:00