Compare commits

...

94 commits

Author SHA1 Message Date
Giulio P
be44b6e6a8 doc: fix typo
Remove a repetition of words in the comments on
libevdev_set_event_value()

Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/131>
2025-12-07 02:31:20 +00:00
Peter Hutterer
139b58e135 libevdev 1.13.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-12-01 15:12:22 +10:00
Peter Hutterer
c6bf238c4e include: sync event codes with kernel 6.18
Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/129>
2025-12-01 14:49:50 +10:00
Peter Hutterer
f3a9c2038d libevdev 1.13.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-10-20 14:49:38 +10:00
Marcos Alano
9289c9826c Sync headers with kernel 6.17
Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/126>
2025-09-28 20:34:21 -03:00
Peter Hutterer
a30a461e82 util: change the bit to shift to ULL
libevdev/libevdev-util.h:45:45: runtime error: left shift of 1 by 63 places cannot be represented in type 'long long'

Fixes: #32
Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/127>
2025-08-13 21:23:10 +10:00
Peter Hutterer
d093b4752a include: sync event codes with kernel 6.16
Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/125>
2025-07-29 09:07:13 +10:00
Peter Hutterer
ac0056961c libevdev 1.13.4 2025-03-25 09:27:07 +10:00
andeston
d06abb81e5 Always push changed mt events when syncing
If the start and end of a touch are dropped, the slot, according to the
kernel, may have a different state. We should inform the client of these
changes even if the slot is not currently active.

For most axes this doesn't matter too much as we expect them to change
during an active touch anyway so we don't expect the kernel's caching to
be a problem. However where the ABS_MT_TOOL_TYPE changed during a sync
we need to inform the client of the new tool type so that future
touchese won't be erroneously treated as e.g. palms.

For a full reproducer see the test case but it comes down to:
- touch down with MT_TOOL_PALM, make sure libevdev reads the state
- change that slot to MT_TOOL_FINGER, trigger a sync
- ensure that libevdev pushes out that tool type change even if the
  slot is not currently active

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/124>
2025-01-06 13:21:29 +10:00
Peter Hutterer
cfd803566c CI: update to latest ci-templates
This allows for using @users.noreply addresses and still pass
ci-fairy checks.

Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/123>
2025-01-06 12:57:50 +10:00
Peter Hutterer
1a8324aeb8 Drop the signed-off-by requirement
We've had this for roughly 10y now and it's value is dubious. Most of
xorg no longer requires, mesa accepts but doesn't require it, most of GNOME
doesn't accept it and neither does systemd.

Let's drop the requirement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/123>
2025-01-06 12:51:05 +10:00
Peter Hutterer
72fa564092 gitlab CI: bump to latest fedoras and ubuntu
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-11-25 10:34:30 +10:00
Peter Hutterer
2342d8c9ee libevdev 1.13.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-09-03 12:16:11 +10:00
Peter Hutterer
54c083378e include: sync event codes with kernel 6.10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-07-15 15:57:02 +10:00
Peter Hutterer
5501633d51 libevdev 1.13.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-05-31 15:16:54 +10:00
Peter Hutterer
080d1d097a include: sync event codes with kernel 6.9
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-05-14 15:23:31 +10:00
Peter Hutterer
414757317d gitlab CI: don't run MR pipelines in forks
Commit originally by Simon Ser in wayland/wayland-protocols!305.

Currently our CI setup has a downside: for each push on a merge
request, two pipelines are triggered. The first is triggered in
the context of the forked repository, and the second is triggered
in the context of the MR in the parent repository.

Replace the workflow rules with the ones in the official docs [1],
so that a branch pipeline isn't triggered when a MR exists for that
branch.

[1]: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-04-30 08:46:00 +10:00
Peter Hutterer
fb5402020f meson.build: remove superfluous double doxygen check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 16:11:08 +10:00
Peter Hutterer
de6ae19483 meson.build: specify the include directory correctly
If libevdev is used as subproject header lookup for libevdev.h fails
because our build directory isn't correctly set as one of the include
directories.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 16:11:08 +10:00
Peter Hutterer
82560ca9d7 meson.build: declare the file list as such
Not much of an effect but where libevdev is used as subproject those
files are now correctly accessible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 16:11:08 +10:00
Peter Hutterer
1ee2399ba8 meson.build: allow disabling building the various tools
A bit of a niche case but this helps with embedding libevdev as static
library when the tools don't matter.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 16:11:08 +10:00
Peter Hutterer
d852e59dd0 gitlab CI: rebuild the images
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 16:04:50 +10:00
Peter Hutterer
8d8a3d8fc7 gitlab CI: drop Ubuntu 22.10
Repos are 404

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 16:04:44 +10:00
Peter Hutterer
cd9bea914c gitlab CI: drop unnecessary B2C_VERSION
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 15:52:50 +10:00
Peter Hutterer
179fc4d370 gitlab CI: update to the same b2c image libinput uses
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 15:26:57 +10:00
Peter Hutterer
703999edec gitlab CI: remove the jobs for the scheduled forced rebuild
This scheduled pipeline no long runs, so let's drop this job.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 15:15:01 +10:00
Peter Hutterer
5db8e66bd3 gitlab CI: update to latest Fedoras
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 15:15:01 +10:00
Peter Hutterer
2e0a0cd271 gitlab CI: update to latest template and use the ci-fairy image
Makes life easier because we don't have to deal with the pip complaints.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-03-21 15:10:00 +10:00
Peter Hutterer
97d0e4d151 CI: add a comment to the meson build helper
We now have an upstream for it so we can sync changes between projects.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-30 15:18:28 +10:00
Peter Hutterer
d21d826b63 CI: bump to new fedoras and ubuntus
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-08 14:45:10 +10:00
Peter Hutterer
d399abca1a tools/publish-doc: enable pushing docs for specific tags
Historically, I copied the docs on the server directly after pushing latest,
but (especially with meson) it's a lot easier to just build that specific tag
locally and rsync it to the correct target directory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-07 23:48:44 +00:00
Peter Hutterer
d7139f1314 tools/publish-doc: build the docs with meson before synching
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-07 23:48:44 +00:00
Peter Hutterer
1cc8c6d491 doc: update the ioctl list with missing ioctls
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-08 09:35:37 +10:00
Peter Hutterer
f201583026 doc: remove duplicate doc entry for EVIOCSKEYCODE
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-08 09:18:57 +10:00
Peter Hutterer
4582559b66 libevdev 1.13.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-05 10:45:30 +10:00
Peter Hutterer
fb3741e0cd include: sync event codes with kernel 6.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-20 08:58:13 +10:00
Enric Balletbo i Serra
bb4404dd91 test: Get the print mode from the CK_VERBOSITY environment variable
On a test run it only prints the summary and one message per failed
test. While having this behaviour by default is nice it might be
interesting in some case to have more information print. Make the print
mode configurable from the environment variable CK_VERBOSITY, which can
have the values "silent", "minimal", "normal" or "verbose" so we can have
different outputs.

    $ sudo CK_VERBOSITY=verbose ./test-libevdev
    Running suite(s): libevdev init tests
     libevdev_has_event tests
     libevdev event tests
     100%: Checks: 79, Failures: 0, Errors: 0
     test-libevdev-init.c:23:P:test_new_device:test_new_device:0: Passed
     test-libevdev-init.c:28:P:test_free_device:test_free_device:0: Passed
     [ ... ]

Note that the default print mode doesn't change after this patch.

Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
2023-04-19 16:40:14 +02:00
Peter Hutterer
db0d4271ed gitlab CI: add new workflow rules
Required for pipelines to run after some infrastructure changes, see
https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/438

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-15 10:21:43 +10:00
Peter Hutterer
689d1eb01c gitlab CI: bump to latest fedoras
The F37 update was delayed by https://github.com/systemd/systemd/pull/25941 which
is now available in F37 as of v251.11

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-02-15 08:31:58 +10:00
Benjamin Tissoires
2eb0bb4be4 CI: bump b2c and kernel
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2023-02-08 11:31:02 +01:00
Alyssa Ross
d8c491f57e
Include all include files in dist tarballs
Otherwise, the distribution tarballs will be generated based on what's
in libevdev_la_SOURCES, which only includes the headers for the
operating system the maintainer happens to be running "make dist"
from.  As a result of this, e.g. the 1.13.0 tarball only includes the
headers for Linux, making the tarball unbuildable for FreeBSD.

"meson dist" was already doing the right thing.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2023-01-13 21:43:04 +00:00
Peter Hutterer
54f4c054ea gitlab CI: sync the meson-build.sh script with libinput
Pulls in the three libinput commits up to 31ecda70087

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-10 08:56:52 +10:00
Peter Hutterer
b2e12fe926 gitlab CI: use b2c instead of qemu
This is copied from libinput's CI but as one large change rather than
cherry-picking the process on how to get here. meson-build.sh is synched
with libinput's version - it is a more generic version anyway.

With this change we no longer require separate images for the qemu runs,
our default image is qemu-capable and can be run in qemu via
boot2container (b2c).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 10:32:01 +10:00
Peter Hutterer
50ac79078e gitlab CI: pass the --no-suite to meson builds
Only use the LIBEVDEV_SKIP_ROOT_TESTS env var in autotools where we need
it, in meson we can use meson to control which tests we (don't) want to
run.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 10:30:47 +10:00
Peter Hutterer
37f71a8493 gitlab CI: drop the ninja dist for every job
Unlike autotools distcheck which ensures we didn't forget to add
anything to the makefiles, ninja dist just zips up the git repo.

It does run the tests though but without suite selection which is a
problem for us here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 10:26:39 +10:00
Peter Hutterer
6be54f75c8 gitlab CI: skip the right tests in the tarball jobs
Use the new needs-uinput suite specifier for the meson build job, and
use --no-tests for ninja dist in the autotools build job.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 10:26:39 +10:00
Peter Hutterer
427af9d248 meson.build: add the tests that need uinput into a needs-uinput suite
This way we can skip it all by meson test --no-suite=needs-uinput

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 10:25:02 +10:00
Peter Hutterer
6d0d778e59 gitlab CI: replace the meson-build.sh with the libinput one
The libinput one is more generic and expressive, taking arguments and
whatnot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 09:25:46 +10:00
Peter Hutterer
ac3d44ee7a gitlab CI: drop MESON_SKIP_TEST variables
In the no-check:meson job, the ninja arg was "dist" so the test would be
run as part of that anyway (and skipped, since we didn't have check).

In the no-doxygen-check:meson job, the ninja arg was zero so the test
would be skipped but since we don't have check we might as well just
run it as empty test suite.

And the same applies to the scan-build job, running the test shouldn't
hurt here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 09:18:17 +10:00
Peter Hutterer
46ed9e53e4 gitlab CI: drop the custom meson to junit conversion script
And always collect test logs, makes it easier to debug when things fail
to go wrong

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-05 09:01:38 +10:00
Peter Hutterer
1e9fb4fe02 test: drop the valgrind make check wrappers from autotools
We have meson with a proper test suite setup and this currently breaks
the CI due to some Arch issues with glibc debuginfo packages. Let's just
drop this so we don't run valgrind unconditionally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-04 15:51:58 +10:00
Peter Hutterer
1489287bf1 gitlab CI: bump to newer Ubuntus
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-04 15:25:06 +10:00
Peter Hutterer
136efe0399 gitlab CI: bump to a newer version of the templates
Required by the debian sid containers, otherwise we fail because of a
missing /etc/apt/sources.list file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-04 15:20:33 +10:00
Peter Hutterer
f45bc03d9f gitlab CI: do not retry the qemu runs
See libinput commit fb4f4131a112201c86c510179cfc939fcfa8aece by Benjamin
Tissoires

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-04 14:46:28 +10:00
Peter Hutterer
4f66455160 gitlab CI: change an explicit Fedora to {{distro}}
See libinput commit 0d602e12a4b66d5b5f27d2a9fd9899d43cf128fe by Benjamin
Tissoires

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-04 14:43:18 +10:00
Peter Hutterer
09fd1f4e66 gitlab CI: prettify the include of templates
Identical to libinput commit c8c825289f1b7575ee10b849c04f5caa60483a7e by
Benjamin Tissoires.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-04 14:41:33 +10:00
illiliti
7820dc8b08 meson: Use proper type for bool object
Fix invalid bool usage which violates official meson specification and thus
breaks muon, an implementation of meson written in C.

Signed-off-by: illiliti <illiliti@protonmail.com>
2022-10-20 23:13:06 +03:00
Zixian Liu
df826a3c54 Correct document 2022-08-16 09:00:08 +00:00
Douglas R. Reno
011946d446 configure.ac: Update the bug report URL.
While I was running the tests for libevdev on a
system, I had a test failure, and it told me to report it to
bugs.freedesktop.org.

This project uses GitLab now, so update the URL.

Signed-off-by: Douglas R. Reno <renodr@linuxfromscratch.org>
2022-08-08 22:26:36 +00:00
Peter Hutterer
ff4276398c libevdev 1.13.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-08-02 11:21:12 +10:00
Peter Hutterer
1da836d0a9 include: sync event codes with kernel 5.19
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-08-02 11:09:51 +10:00
Peter Hutterer
b6c9dfd9d7 meson: drop the uinput.h header listing
This is a noop, meson gets its compile dependencies from the compiler,
listing it here makes no difference.

Same is true for listing the other two linux/input/*.h headers as
sources.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-12 09:50:08 +00:00
Peter Hutterer
0afed6479d meson.build: drop the use of join_paths
Replace with the slash notation supported since 0.49

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-12 09:50:08 +00:00
Peter Hutterer
c6c4d33474 meson.build: use project_source_root() instead of source_root()
The latter is deprecated, so let's bump the meson version requirement
and use the newer, shiny feature.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-12 09:50:08 +00:00
Peter Hutterer
c9781f00f3 uinput: use named initializers for the event struct
With the 64 bit timestamps, the struct layout changes into a flatter
version, so let's use the input_event_(u)sec helpers to transparently
handle this.

Fixes #25

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-11 15:32:59 +10:00
Peter Hutterer
0c7e1d2f67 Fix a few whitespace/coding style issues
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-11 15:31:45 +10:00
Peter Hutterer
2d49be8303 Fix a compiler warning
[1/16] Compiling C object libevdev.so.2.3.0.p/libevdev_libevdev.c.o
../libevdev/libevdev.c:665:40: warning: argument 2 of type ‘struct slot_change_state[dev->num_slots]’ declared as a variable length array [-Wvla-parameter]
  665 |               struct slot_change_state changes_out[dev->num_slots])
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../libevdev/libevdev.c:47:52: note: previously declared as a pointer ‘struct slot_change_state *’
   47 |                          struct slot_change_state *changes_out);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-11 15:31:45 +10:00
Peter Hutterer
c2eaaa171e meson: up the timeout to 10s per test
Fixes #26

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-11 15:28:23 +10:00
Peter Hutterer
de2daf8d36 meson.build: install the mouse-dpi-tool man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-03-25 14:37:28 +10:00
Peter Hutterer
8ced382eb8 libevdev 1.12.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-03-25 14:32:48 +10:00
Peter Hutterer
f3c3b0a233 include: sync key codes with kernel 5.17
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-03-22 12:34:08 +10:00
Peter Hutterer
7c43e86944 gitlab CI: update to current distribution versions, drop Centos
No big point building for Centos 7 anywmore, and Centos 8 is now Centos
Stream only which needs fixing in the CI templates first.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-02 00:29:35 +00:00
Stephen Kitt
066d9caf55
Add a manpage for mouse-dpi-tool
Signed-off-by: Stephen Kitt <steve@sk2.org>
2021-11-15 08:58:11 +01:00
Peter Hutterer
69403a63ed libevdev 1.12.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-09 09:52:06 +10:00
Peter Hutterer
d03f9b6616 tools: add a helper tool to list all currently known codes
A non-installed tool to make it easy to check if newly added codes are
indeed supported correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-09 09:46:16 +10:00
Peter Hutterer
fdba5a41dd include: sync event codes with kernel 5.15
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-09 08:54:21 +10:00
José Expósito
889fc01c81 doc: fix initialization and setup error
Remove an unnecessary and unmatched curly bracket from the demo code.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-04 13:30:17 +02:00
José Expósito
8a4f45df5b doc: fix uinput device creation warnings
The example code for creating uinput devices produces the following
warnings:

warning: unused variable ‘ev’ [-Wunused-variable]
   | struct input_event ev[2];
   |                    ^~
warning: unused variable ‘new_fd’ [-Wunused-variable]
   | int fd, new_fd, uifd;
   |         ^~~~~~
warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   |     return err;
   |            ^~~

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-04 13:21:42 +02:00
Ulrich Ölmann
9b918d316a doc: fix typos
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
2021-08-17 18:33:58 +02:00
Ulrich Ölmann
5fc81553f5 doc: fix uinput example code
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
2021-08-17 15:09:26 +02:00
Peter Hutterer
a6970e1cec gitlab CI: update to latest ci-templates
We can ditch the custom localhost usages and instead use the vmctl and
ssh-config aliases.

Signed-off-by:	Peter Hutterer <peter.hutterer@who-t.net>
2021-07-26 10:23:39 +10:00
Simeon Schaub
662c84d80e
build: properly link against rt
This is especially relevant for cross-compilation, since libevdev uses
`clock_gettime`.
This came up in https://github.com/JuliaPackaging/Yggdrasil/pull/3201.

Signed-off-by: Simeon Schaub <simeondavidschaub99@gmail.com>
2021-06-21 02:56:52 +02:00
Peter Hutterer
bb1cd0dd57 gitlab CI: bump to Fedora 34 and Ubuntu 21.04
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-19 10:37:21 +10:00
Peter Hutterer
a53c6d1154 gitlab CI: make the tarball distro selection automatic
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-19 10:36:58 +10:00
Peter Hutterer
4e5babd7a1 gitlab CI: make the qemu selection automatic
Generate the snippet for whichever is the last version in the list for the
want_qemu tag.

And move the want_qemu tag up so it's more obvious in the config file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-19 10:36:53 +10:00
Richard Purdie
8d70f44989 make-event-names: Fix determinism issue
The order of dict values is not deterministic in python leading to differing 
header file generation which results in differing build output for the same
configuration. Sort to remove this inconsistency and make the output 
reproducible.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Reviewed-by: Filipe Laíns <lains@archlinux.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-22 07:06:46 +10:00
Peter Hutterer
8855f1ac59 libevdev 1.11.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-01 15:51:10 +10:00
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
7eae5e322c libevdev 1.10.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-11 13:07:47 +10:00
Peter Hutterer
70881516f2 doc: fix conflicting documentation for libevdev_get_event_value()
Yes, the value we return is from the currently active slot, but there are a
few niche cases where the active slot changes from what the client may think
it is. So let's call it undefined like the other half of the documentation
already does.

Fixes #20

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-08 09:58:16 +10:00
Peter Hutterer
510bde8f47 gitlab CI: use Fedora 33 and Ubuntu 20.10
This requires latest CI templates for the mkosi changes. Since the start_vm.sh
script is now gone, switch to using vmctl instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-04 11:49:42 +10:00
Peter Hutterer
7f53bcfab3 gitlab CI: make the custom build reference automated
We still require Fedora for the various jobs with custom autotools/meson
configurations. But we might as well make it dependent on the config file
entries only than hardcoding it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-04 10:59:25 +10:00
Peter Hutterer
896d087a0e include: sync event codes with kernel 5.10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-14 00:17:15 +00:00
Shuo Wang
74dc7ff245 CODING_STYLE.md: fix a typo
Signed-off-by: Shuo Wang <wangshuo47@huawei.com>
2020-11-03 14:42:25 +08:00
48 changed files with 1025 additions and 1383 deletions

View file

@ -4,33 +4,18 @@
# # # #
######################################## ########################################
.templates_sha: &template_sha ca99d9418390fb5faaa7f2407b94c733d7ec6a37 # see https://docs.gitlab.com/ee/ci/yaml/#includefile .templates_sha: &template_sha e195d80f35b45cc73668be3767b923fd76c70ed5 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include: include:
# Alpine container builder template
- project: 'freedesktop/ci-templates' - project: 'freedesktop/ci-templates'
ref: *template_sha ref: *template_sha
file: '/templates/alpine.yml' file:
# Arch container builder template - '/templates/alpine.yml'
- project: 'freedesktop/ci-templates' - '/templates/arch.yml'
ref: *template_sha - '/templates/debian.yml'
file: '/templates/arch.yml' - '/templates/fedora.yml'
# Centos container builder template - '/templates/ubuntu.yml'
- project: 'freedesktop/ci-templates' - '/templates/ci-fairy.yml'
ref: *template_sha
file: '/templates/centos.yml'
# Debian container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/debian.yml'
# Fedora container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/fedora.yml'
# Ubuntu container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/ubuntu.yml'
stages: stages:
- prep # rebuild the container images if there is a change - prep # rebuild the container images if there is a change
@ -42,10 +27,16 @@ stages:
- container_clean # clean up unused container images - container_clean # clean up unused container images
- merge-check # check for a merge request - merge-check # check for a merge request
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
variables: variables:
# The upstrem repository we will check for images # The upstrem repository we will check for images
FDO_UPSTREAM_REPO: libevdev/libevdev FDO_UPSTREAM_REPO: libevdev/libevdev
LIBEVDEV_SKIP_ROOT_TESTS: 1
GIT_DEPTH: 1 GIT_DEPTH: 1
MESON_BUILDDIR: 'build dir' MESON_BUILDDIR: 'build dir'
@ -55,9 +46,9 @@ variables:
- _build/test/test-suite.log - _build/test/test-suite.log
- $MESON_BUILDDIR/meson-logs/ - $MESON_BUILDDIR/meson-logs/
expire_in: 1 week expire_in: 1 week
when: on_failure when: always
reports: reports:
junit: $MESON_BUILDDIR/junit-*.xml junit: $MESON_BUILDDIR/*junit*.xml
.autotools_build: .autotools_build:
extends: extends:
@ -70,71 +61,57 @@ variables:
- make check - make check
- if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
- popd > /dev/null - popd > /dev/null
variables:
LIBEVDEV_SKIP_ROOT_TESTS: 1
.meson_build: .meson_build:
extends: extends:
- .default_artifacts - .default_artifacts
script: script:
- .gitlab-ci/meson-build.sh - .gitlab-ci/meson-build.sh --run-test
variables:
MESON_TEST_ARGS: '--no-suite=needs-uinput'
.fedora:31: .fedora:40:
extends: .fdo.distribution-image@fedora extends: .fdo.distribution-image@fedora
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: '31' FDO_DISTRIBUTION_VERSION: '40'
.fedora:32: .fedora:41:
extends: .fdo.distribution-image@fedora extends: .fdo.distribution-image@fedora
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: '32' FDO_DISTRIBUTION_VERSION: '41'
.ubuntu:20.04: .ubuntu:24.10:
extends: .fdo.distribution-image@ubuntu extends: .fdo.distribution-image@ubuntu
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: '20.04' FDO_DISTRIBUTION_VERSION: '24.10'
.ubuntu:19.10:
extends: .fdo.distribution-image@ubuntu
variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0'
FDO_DISTRIBUTION_VERSION: '19.10'
.debian:stable: .debian:stable:
extends: .fdo.distribution-image@debian extends: .fdo.distribution-image@debian
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: 'stable' FDO_DISTRIBUTION_VERSION: 'stable'
.debian:sid: .debian:sid:
extends: .fdo.distribution-image@debian extends: .fdo.distribution-image@debian
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: 'sid' FDO_DISTRIBUTION_VERSION: 'sid'
.centos:7:
extends: .fdo.distribution-image@centos
variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0'
FDO_DISTRIBUTION_VERSION: '7'
.centos:8:
extends: .fdo.distribution-image@centos
variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0'
FDO_DISTRIBUTION_VERSION: '8'
.arch:rolling: .arch:rolling:
extends: .fdo.distribution-image@arch extends: .fdo.distribution-image@arch
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: 'rolling' FDO_DISTRIBUTION_VERSION: 'rolling'
.alpine:latest: .alpine:latest:
extends: .fdo.distribution-image@alpine extends: .fdo.distribution-image@alpine
variables: variables:
FDO_DISTRIBUTION_TAG: '2020-09-11.0' FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: 'latest' FDO_DISTRIBUTION_VERSION: 'latest'
@ -150,14 +127,11 @@ variables:
# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
# #
check-ci-script: check-ci-script:
image: golang:alpine extends:
- .fdo.ci-fairy
stage: prep stage: prep
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
- ci-fairy generate-template - ci-fairy generate-template --verify && exit 0 || true
- git diff --exit-code && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify" - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1 - exit 1
@ -166,13 +140,13 @@ check-ci-script:
# #
check-commit: check-commit:
image: golang:alpine extends:
- .fdo.ci-fairy
stage: prep stage: prep
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
- ci-fairy check-commits --signed-off-by --junit-xml=results.xml - ci-fairy -vv check-commits --junit-xml=results.xml && exit 0 || true
- echo "Error checking the commit message format. Please verify"
- exit 1
except: except:
- master@libevdev/libevdev - master@libevdev/libevdev
variables: variables:
@ -186,11 +160,9 @@ check-commit:
# #
check-merge-request: check-merge-request:
image: golang:alpine extends:
- .fdo.ci-fairy
stage: merge-check stage: merge-check
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
artifacts: artifacts:
@ -198,11 +170,13 @@ check-merge-request:
reports: reports:
junit: results.xml junit: results.xml
allow_failure: true allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
.fedora.packages: .fedora.packages:
variables: variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer' FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer systemd-udev qemu-img qemu-system-x86-core qemu-system-aarch64-core jq python3-click python3-rich'
.ubuntu.packages: .ubuntu.packages:
variables: variables:
@ -212,153 +186,48 @@ check-merge-request:
variables: variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils' FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
.centos.packages:
variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
.arch.packages: .arch.packages:
variables: variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen' FDO_DISTRIBUTION_PACKAGES: 'git gc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
.alpine.packages: .alpine.packages:
variables: variables:
FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers' FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
# Pulls in the qemu container from upstream or rebuilds it if missing
.fedora:31@qemu-prep:
extends:
- .fedora:31
- .fedora.packages
- .fdo.qemu-build@fedora
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-2020-09-11.0
allow_failure: true
# Always rebuilds the container
.fedora:31@qemu-forced-rebuild:
extends:
- .fedora:31@qemu-prep
variables:
FDO_FORCE_REBUILD: 1
only:
- schedules
# Pulls in the qemu container from upstream or rebuilds it if missing
.fedora:32@qemu-prep:
extends:
- .fedora:32
- .fedora.packages
- .fdo.qemu-build@fedora
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-2020-09-11.0
allow_failure: true
# Always rebuilds the container
.fedora:32@qemu-forced-rebuild:
extends:
- .fedora:32@qemu-prep
variables:
FDO_FORCE_REBUILD: 1
only:
- schedules
# This is the actual job
fedora:32@qemu-prep:
extends: .fedora:32@qemu-prep
fedora:32@qemu-forced-rebuild:
extends: .fedora:32@qemu-forced-rebuild
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
fedora:31@container-prep: fedora:40@container-prep:
extends: extends:
- .fedora:31 - .fedora:40
- .fedora.packages - .fedora.packages
- .fdo.container-build@fedora - .fdo.container-build@fedora
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
fedora:31@container-forced-rebuild:
extends:
- fedora:31@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
fedora:32@container-prep: fedora:41@container-prep:
extends: extends:
- .fedora:32 - .fedora:41
- .fedora.packages - .fedora.packages
- .fdo.container-build@fedora - .fdo.container-build@fedora
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
fedora:32@container-forced-rebuild:
extends:
- fedora:32@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
ubuntu:20.04@container-prep: ubuntu:24.10@container-prep:
extends: extends:
- .ubuntu:20.04 - .ubuntu:24.10
- .ubuntu.packages - .ubuntu.packages
- .fdo.container-build@ubuntu - .fdo.container-build@ubuntu
stage: prep stage: prep
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
ubuntu:20.04@container-forced-rebuild:
extends:
- ubuntu:20.04@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing
ubuntu:19.10@container-prep:
extends:
- .ubuntu:19.10
- .ubuntu.packages
- .fdo.container-build@ubuntu
stage: prep
variables:
GIT_STRATEGY: none
# Always rebuilds the container
ubuntu:19.10@container-forced-rebuild:
extends:
- ubuntu:19.10@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
debian:stable@container-prep: debian:stable@container-prep:
@ -370,15 +239,6 @@ debian:stable@container-prep:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
debian:stable@container-forced-rebuild:
extends:
- debian:stable@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
debian:sid@container-prep: debian:sid@container-prep:
@ -390,55 +250,6 @@ debian:sid@container-prep:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
debian:sid@container-forced-rebuild:
extends:
- debian:sid@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing
centos:7@container-prep:
extends:
- .centos:7
- .centos.packages
- .fdo.container-build@centos
stage: prep
variables:
GIT_STRATEGY: none
# Always rebuilds the container
centos:7@container-forced-rebuild:
extends:
- centos:7@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing
centos:8@container-prep:
extends:
- .centos:8
- .centos.packages
- .fdo.container-build@centos
stage: prep
variables:
GIT_STRATEGY: none
# Always rebuilds the container
centos:8@container-forced-rebuild:
extends:
- centos:8@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
arch:rolling@container-prep: arch:rolling@container-prep:
@ -450,15 +261,6 @@ arch:rolling@container-prep:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
arch:rolling@container-forced-rebuild:
extends:
- arch:rolling@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
# Pulls in the container from upstream or rebuilds it if missing # Pulls in the container from upstream or rebuilds it if missing
alpine:latest@container-prep: alpine:latest@container-prep:
@ -470,15 +272,6 @@ alpine:latest@container-prep:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
alpine:latest@container-forced-rebuild:
extends:
- alpine:latest@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
################################################################# #################################################################
# # # #
@ -492,11 +285,9 @@ alpine:latest@container-forced-rebuild:
# the registry and will remove any that are not tagged with the provided # the registry and will remove any that are not tagged with the provided
# $container_image:$tag # $container_image:$tag
.container-clean: .container-clean:
extends:
- .fdo.ci-fairy
stage: container_clean stage: container_clean
image: golang:alpine
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
# Go to your Profile, Settings, Access Tokens # Go to your Profile, Settings, Access Tokens
# Create a personal token with 'api' scope, copy the value. # Create a personal token with 'api' scope, copy the value.
@ -511,33 +302,26 @@ alpine:latest@container-forced-rebuild:
only: only:
- schedules - schedules
### fedora 31 ### fedora 40
fedora:31@container-clean: fedora:40@container-clean:
extends: extends:
- .fedora:31 - .fedora:40
- .container-clean - .container-clean
needs: ["fedora:31@container-prep"] needs: ["fedora:40@container-prep"]
### fedora 32 ### fedora 41
fedora:32@container-clean: fedora:41@container-clean:
extends: extends:
- .fedora:32 - .fedora:41
- .container-clean - .container-clean
needs: ["fedora:32@container-prep"] needs: ["fedora:41@container-prep"]
### ubuntu 20.04 ### ubuntu 24.10
ubuntu:20.04@container-clean: ubuntu:24.10@container-clean:
extends: extends:
- .ubuntu:20.04 - .ubuntu:24.10
- .container-clean - .container-clean
needs: ["ubuntu:20.04@container-prep"] needs: ["ubuntu:24.10@container-prep"]
### ubuntu 19.10
ubuntu:19.10@container-clean:
extends:
- .ubuntu:19.10
- .container-clean
needs: ["ubuntu:19.10@container-prep"]
### debian stable ### debian stable
debian:stable@container-clean: debian:stable@container-clean:
@ -553,20 +337,6 @@ debian:sid@container-clean:
- .container-clean - .container-clean
needs: ["debian:sid@container-prep"] needs: ["debian:sid@container-prep"]
### centos 7
centos:7@container-clean:
extends:
- .centos:7
- .container-clean
needs: ["centos:7@container-prep"]
### centos 8
centos:8@container-clean:
extends:
- .centos:8
- .container-clean
needs: ["centos:8@container-prep"]
### arch rolling ### arch rolling
arch:rolling@container-clean: arch:rolling@container-clean:
extends: extends:
@ -601,68 +371,51 @@ alpine:latest@container-clean:
- .meson_build - .meson_build
stage: build stage: build
dependencies: [] dependencies: []
variables:
NINJA_ARGS: "dist"
fedora:31@autotools-build: fedora:40@autotools-build:
extends: extends:
- .fedora:31 - .fedora:40
- .autotools-build@template - .autotools-build@template
stage: autotools stage: autotools
needs: ['fedora:31@container-prep'] needs: ['fedora:40@container-prep']
fedora:31@meson-build: fedora:40@meson-build:
extends: extends:
- .fedora:31 - .fedora:40
- .meson-build@template - .meson-build@template
stage: meson stage: meson
needs: ['fedora:31@container-prep'] needs: ['fedora:40@container-prep']
fedora:32@autotools-build: fedora:41@autotools-build:
extends: extends:
- .fedora:32 - .fedora:41
- .autotools-build@template - .autotools-build@template
stage: autotools stage: autotools
needs: ['fedora:32@container-prep'] needs: ['fedora:41@container-prep']
fedora:32@meson-build: fedora:41@meson-build:
extends: extends:
- .fedora:32 - .fedora:41
- .meson-build@template - .meson-build@template
stage: meson stage: meson
needs: ['fedora:32@container-prep'] needs: ['fedora:41@container-prep']
ubuntu:20.04@autotools-build: ubuntu:24.10@autotools-build:
extends: extends:
- .ubuntu:20.04 - .ubuntu:24.10
- .autotools-build@template - .autotools-build@template
stage: autotools stage: autotools
needs: ['ubuntu:20.04@container-prep'] needs: ['ubuntu:24.10@container-prep']
ubuntu:20.04@meson-build: ubuntu:24.10@meson-build:
extends: extends:
- .ubuntu:20.04 - .ubuntu:24.10
- .meson-build@template - .meson-build@template
stage: meson stage: meson
needs: ['ubuntu:20.04@container-prep'] needs: ['ubuntu:24.10@container-prep']
ubuntu:19.10@autotools-build:
extends:
- .ubuntu:19.10
- .autotools-build@template
stage: autotools
needs: ['ubuntu:19.10@container-prep']
ubuntu:19.10@meson-build:
extends:
- .ubuntu:19.10
- .meson-build@template
stage: meson
needs: ['ubuntu:19.10@container-prep']
debian:stable@autotools-build: debian:stable@autotools-build:
@ -695,28 +448,6 @@ debian:sid@meson-build:
needs: ['debian:sid@container-prep'] needs: ['debian:sid@container-prep']
centos:7@autotools-build:
extends:
- .centos:7
- .autotools-build@template
stage: autotools
variables:
MAKE_ARGS: '' # disable distcheck, requires doxygen
needs: ['centos:7@container-prep']
centos:8@autotools-build:
extends:
- .centos:8
- .autotools-build@template
stage: autotools
variables:
MAKE_ARGS: '' # disable distcheck, requires doxygen
needs: ['centos:8@container-prep']
arch:rolling@autotools-build: arch:rolling@autotools-build:
extends: extends:
- .arch:rolling - .arch:rolling
@ -753,10 +484,10 @@ alpine:latest@meson-build:
# because they're supposed to fail equally on all # because they're supposed to fail equally on all
.fedora-custom-build@autotools-template: .fedora-custom-build@autotools-template:
extends: extends:
- .fedora:31 - .fedora:40
- .autotools-build@template - .autotools-build@template
stage: build stage: build
needs: ['fedora:31@container-prep'] needs: ['fedora:40@container-prep']
no-valgrind:autotools: no-valgrind:autotools:
extends: .fedora-custom-build@autotools-template extends: .fedora-custom-build@autotools-template
@ -795,10 +526,10 @@ enable-gcov:autotools:
.fedora-custom-build@meson-template: .fedora-custom-build@meson-template:
extends: extends:
- .fedora:31 - .fedora:40
- .meson-build@template - .meson-build@template
stage: build stage: build
needs: ['fedora:31@container-prep'] needs: ['fedora:40@container-prep']
no-valgrind:meson: no-valgrind:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
@ -811,7 +542,6 @@ no-check:meson:
- dnf remove -y check check-devel - dnf remove -y check check-devel
variables: variables:
MESON_ARGS: -Dtests=disabled MESON_ARGS: -Dtests=disabled
SKIP_MESON_TEST: 1
# doxygen is required for dist # doxygen is required for dist
no-doxygen:meson: no-doxygen:meson:
@ -830,7 +560,6 @@ no-doxygen-check-valgrind:meson:
variables: variables:
MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
NINJA_ARGS: '' NINJA_ARGS: ''
SKIP_MESON_TEST: 1
enable-gcov:meson: enable-gcov:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
@ -841,7 +570,6 @@ scan-build:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
variables: variables:
NINJA_ARGS: 'scan-build' NINJA_ARGS: 'scan-build'
SKIP_MESON_TEST: 1
static-build:meson: static-build:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
@ -852,7 +580,7 @@ static-build:meson:
soname: soname:
extends: extends:
- .fedora:31 - .fedora:40
stage: build stage: build
script: script:
- ./autogen.sh --prefix=$PWD/prefix-autotools/ - ./autogen.sh --prefix=$PWD/prefix-autotools/
@ -861,7 +589,7 @@ soname:
- meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/ - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
- ninja -C "$MESON_BUILDDIR" install - ninja -C "$MESON_BUILDDIR" install
- ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
needs: ['fedora:31@container-prep'] needs: ['fedora:40@container-prep']
################################################################# #################################################################
# # # #
@ -871,74 +599,54 @@ soname:
.check_tainted: &check_tainted | .check_tainted: &check_tainted |
# make sure the kernel is not tainted # make sure the kernel is not tainted
if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]]; if [[ "$(/app/vmctl exec cat /proc/sys/kernel/tainted)" -gt 0 ]];
then then
echo tainted kernel ; echo tainted kernel ;
exit 1 ; exit 1 ;
fi fi
.qemu@fedora:32: # build on the host, then run a systemd service to execute the test suite
# inside the qemu VM handled by b2c
.build-in-b2c@template:
extends: extends:
- .fedora:32 - .default_artifacts
stage: VM
image: $CI_REGISTRY_IMAGE/$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
tags: tags:
- kvm - kvm
variables: variables:
MESON_BUILDDIR: build_dir MESON_BUILDDIR: build_dir
B2C_KERNEL: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v6.5/bzImage
B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
B2C_COMMAND: .gitlab-ci/start-in-systemd.sh
script: script:
# start our vm, no args required # first build in the host container
- /app/start_vm.sh - .gitlab-ci/meson-build.sh --skip-test
- *check_tainted # pull b2c
- curl -L -o /app/boot2container https://gitlab.freedesktop.org/gfx-ci/boot2container/-/raw/2ff65156ba67fa8a0c309a4fc16c5df1a88a3844/vm2c.py
- chmod +x /app/boot2container
- "scp -P 5555 -r $PWD localhost:" # runs the test suite only
- echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv - /app/boot2container
- echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
- echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
- echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
- echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
- "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
- ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
# no matter the results of the tests, we want to fetch the logs
- scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
- *check_tainted
- ssh localhost -p 5555 halt || true
- sleep 2
- pkill qemu || true
- if [[ ! -e .success ]] ;
then
exit 1 ;
fi
artifacts:
name: "qemu-meson-logs-$CI_JOB_NAME"
when: always
expire_in: 1 week
paths:
- $MESON_BUILDDIR/meson-logs
- console.out
reports:
junit: $MESON_BUILDDIR/junit-*.xml
retry:
max: 2
when: script_failure
needs: ['fedora:32@qemu-prep']
qemu:meson: qemu:meson:
extends: .qemu@fedora:32 stage: VM
extends:
- .fdo.distribution-image@fedora
- .fedora:41
- .build-in-b2c@template
needs:
- "fedora:41@container-prep"
qemu:meson:valgrind: qemu:meson:valgrind:
extends: .qemu@fedora:32 extends:
- qemu:meson
variables: variables:
MESON_TEST_ARGS: '--setup=valgrind' MESON_TEST_ARGS: '--setup=valgrind'
meson-from-tarball: meson-from-tarball:
extends: extends:
- .fedora:32 - .fedora:41
stage: tarballs stage: tarballs
script: script:
- export INSTALLDIR="$PWD/_inst" - export INSTALLDIR="$PWD/_inst"
@ -946,26 +654,26 @@ meson-from-tarball:
- pushd _build > /dev/null - pushd _build > /dev/null
- ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
- make - make
- make distcheck - make dist
- popd > /dev/null - popd > /dev/null
- mkdir -p _tarball_dir - mkdir -p _tarball_dir
- tar xf _build/libevdev-*.tar.xz -C _tarball_dir - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
- pushd _tarball_dir/libevdev-*/ > /dev/null - pushd _tarball_dir/libevdev-*/ > /dev/null
- meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR" - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
- ninja -C "$MESON_BUILDDIR" test - meson test -C "$MESON_BUILDDIR" --no-suite="needs-uinput"
- ninja -C "$MESON_BUILDDIR" install - ninja -C "$MESON_BUILDDIR" install
- popd > /dev/null - popd > /dev/null
- ls -lR $INSTALLDIR - ls -lR $INSTALLDIR
needs: ['fedora:32@container-prep'] needs: ['fedora:41@container-prep']
autotools-from-tarball: autotools-from-tarball:
extends: extends:
- .fedora:32 - .fedora:41
stage: tarballs stage: tarballs
script: script:
- export INSTALLDIR="$PWD/_inst" - export INSTALLDIR="$PWD/_inst"
- meson "$MESON_BUILDDIR" - meson "$MESON_BUILDDIR"
- ninja -C "$MESON_BUILDDIR" dist - meson dist -C "$MESON_BUILDDIR" --no-tests
- mkdir -p _tarball_dir - mkdir -p _tarball_dir
- tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
- pushd _tarball_dir/libevdev-*/ > /dev/null - pushd _tarball_dir/libevdev-*/ > /dev/null
@ -978,4 +686,7 @@ autotools-from-tarball:
- popd > /dev/null - popd > /dev/null
- popd > /dev/null - popd > /dev/null
- ls -lR $INSTALLDIR - ls -lR $INSTALLDIR
needs: ['fedora:32@container-prep'] variables:
LIBEVDEV_SKIP_ROOT_TESTS: 1
needs: ['fedora:41@container-prep']

View file

@ -6,15 +6,16 @@
# # # #
######################################## ########################################
.templates_sha: &template_sha ca99d9418390fb5faaa7f2407b94c733d7ec6a37 # see https://docs.gitlab.com/ee/ci/yaml/#includefile .templates_sha: &template_sha e195d80f35b45cc73668be3767b923fd76c70ed5 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include: include:
{% for distribution in distributions|map(attribute='name')|unique()|sort() %}
# {{ distribution.capitalize() }} container builder template
- project: 'freedesktop/ci-templates' - project: 'freedesktop/ci-templates'
ref: *template_sha ref: *template_sha
file: '/templates/{{distribution}}.yml' file:
{% for distribution in distributions|map(attribute='name')|unique()|sort() %}
- '/templates/{{distribution}}.yml'
{% endfor %} {% endfor %}
- '/templates/ci-fairy.yml'
stages: stages:
- prep # rebuild the container images if there is a change - prep # rebuild the container images if there is a change
@ -26,10 +27,16 @@ stages:
- container_clean # clean up unused container images - container_clean # clean up unused container images
- merge-check # check for a merge request - merge-check # check for a merge request
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
variables: variables:
# The upstrem repository we will check for images # The upstrem repository we will check for images
FDO_UPSTREAM_REPO: libevdev/libevdev FDO_UPSTREAM_REPO: libevdev/libevdev
LIBEVDEV_SKIP_ROOT_TESTS: 1
GIT_DEPTH: 1 GIT_DEPTH: 1
MESON_BUILDDIR: 'build dir' MESON_BUILDDIR: 'build dir'
@ -39,9 +46,9 @@ variables:
- _build/test/test-suite.log - _build/test/test-suite.log
- $MESON_BUILDDIR/meson-logs/ - $MESON_BUILDDIR/meson-logs/
expire_in: 1 week expire_in: 1 week
when: on_failure when: always
reports: reports:
junit: $MESON_BUILDDIR/junit-*.xml junit: $MESON_BUILDDIR/*junit*.xml
.autotools_build: .autotools_build:
extends: extends:
@ -54,12 +61,16 @@ variables:
- make check - make check
- if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
- popd > /dev/null - popd > /dev/null
variables:
LIBEVDEV_SKIP_ROOT_TESTS: 1
.meson_build: .meson_build:
extends: extends:
- .default_artifacts - .default_artifacts
script: script:
- .gitlab-ci/meson-build.sh - .gitlab-ci/meson-build.sh --run-test
variables:
MESON_TEST_ARGS: '--no-suite=needs-uinput'
{# Generate templates for every distribution/version combination we want, any {# Generate templates for every distribution/version combination we want, any
job can then just extends: .name:version and the images will sort job can then just extends: .name:version and the images will sort
@ -87,14 +98,11 @@ variables:
# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
# #
check-ci-script: check-ci-script:
image: golang:alpine extends:
- .fdo.ci-fairy
stage: prep stage: prep
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
- ci-fairy generate-template - ci-fairy generate-template --verify && exit 0 || true
- git diff --exit-code && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify" - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1 - exit 1
@ -103,13 +111,13 @@ check-ci-script:
# #
check-commit: check-commit:
image: golang:alpine extends:
- .fdo.ci-fairy
stage: prep stage: prep
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
- ci-fairy check-commits --signed-off-by --junit-xml=results.xml - ci-fairy -vv check-commits --junit-xml=results.xml && exit 0 || true
- echo "Error checking the commit message format. Please verify"
- exit 1
except: except:
- master@libevdev/libevdev - master@libevdev/libevdev
variables: variables:
@ -123,11 +131,9 @@ check-commit:
# #
check-merge-request: check-merge-request:
image: golang:alpine extends:
- .fdo.ci-fairy
stage: merge-check stage: merge-check
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
artifacts: artifacts:
@ -135,6 +141,8 @@ check-merge-request:
reports: reports:
junit: results.xml junit: results.xml
allow_failure: true allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
{% for distro in distributions %} {% for distro in distributions %}
@ -144,43 +152,6 @@ check-merge-request:
{% endfor %} {% endfor %}
{% for distro in distributions %}
{% if distro.want_qemu %}
{% for version in distro.versions %}
# Pulls in the qemu container from upstream or rebuilds it if missing
.{{ distro.name }}:{{ version }}@qemu-prep:
extends:
- .{{ distro.name }}:{{ version }}
- .{{ distro.name}}.packages
- .fdo.qemu-build@fedora
stage: prep
tags:
- kvm
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }}
allow_failure: true
# Always rebuilds the container
.{{ distro.name }}:{{ version }}@qemu-forced-rebuild:
extends:
- .{{ distro.name }}:{{ version }}@qemu-prep
variables:
FDO_FORCE_REBUILD: 1
only:
- schedules
{% endfor %}
{% endif %}
{% endfor %}
# This is the actual job
fedora:32@qemu-prep:
extends: .fedora:32@qemu-prep
fedora:32@qemu-forced-rebuild:
extends: .fedora:32@qemu-forced-rebuild
{% for distro in distributions %} {% for distro in distributions %}
{% for version in distro.versions %} {% for version in distro.versions %}
@ -194,15 +165,6 @@ fedora:32@qemu-forced-rebuild:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
# Always rebuilds the container
{{ distro.name }}:{{ version }}@container-forced-rebuild:
extends:
- {{ distro.name }}:{{ version }}@container-prep
only:
- schedules
variables:
FDO_FORCE_REBUILD: 1
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
@ -218,11 +180,9 @@ fedora:32@qemu-forced-rebuild:
# the registry and will remove any that are not tagged with the provided # the registry and will remove any that are not tagged with the provided
# $container_image:$tag # $container_image:$tag
.container-clean: .container-clean:
extends:
- .fdo.ci-fairy
stage: container_clean stage: container_clean
image: golang:alpine
before_script:
- apk add python3 py-pip git
- pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script: script:
# Go to your Profile, Settings, Access Tokens # Go to your Profile, Settings, Access Tokens
# Create a personal token with 'api' scope, copy the value. # Create a personal token with 'api' scope, copy the value.
@ -268,8 +228,6 @@ fedora:32@qemu-forced-rebuild:
- .meson_build - .meson_build
stage: build stage: build
dependencies: [] dependencies: []
variables:
NINJA_ARGS: "dist"
{% for distro in distributions %} {% for distro in distributions %}
{% for version in distro.versions %} {% for version in distro.versions %}
@ -311,12 +269,13 @@ fedora:32@qemu-forced-rebuild:
# #
# We only run the build option combinations on one image # We only run the build option combinations on one image
# because they're supposed to fail equally on all # because they're supposed to fail equally on all
{% set custom_build_distro = distributions|selectattr("name", "equalto", "fedora")|first() %}
.fedora-custom-build@autotools-template: .fedora-custom-build@autotools-template:
extends: extends:
- .fedora:31 - .{{custom_build_distro.name}}:{{custom_build_distro.versions|first()}}
- .autotools-build@template - .autotools-build@template
stage: build stage: build
needs: ['fedora:31@container-prep'] needs: ['{{custom_build_distro.name}}:{{custom_build_distro.versions|first()}}@container-prep']
no-valgrind:autotools: no-valgrind:autotools:
extends: .fedora-custom-build@autotools-template extends: .fedora-custom-build@autotools-template
@ -355,10 +314,10 @@ enable-gcov:autotools:
.fedora-custom-build@meson-template: .fedora-custom-build@meson-template:
extends: extends:
- .fedora:31 - .{{custom_build_distro.name}}:{{custom_build_distro.versions|first()}}
- .meson-build@template - .meson-build@template
stage: build stage: build
needs: ['fedora:31@container-prep'] needs: ['{{custom_build_distro.name}}:{{custom_build_distro.versions|first()}}@container-prep']
no-valgrind:meson: no-valgrind:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
@ -371,7 +330,6 @@ no-check:meson:
- dnf remove -y check check-devel - dnf remove -y check check-devel
variables: variables:
MESON_ARGS: -Dtests=disabled MESON_ARGS: -Dtests=disabled
SKIP_MESON_TEST: 1
# doxygen is required for dist # doxygen is required for dist
no-doxygen:meson: no-doxygen:meson:
@ -390,7 +348,6 @@ no-doxygen-check-valgrind:meson:
variables: variables:
MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
NINJA_ARGS: '' NINJA_ARGS: ''
SKIP_MESON_TEST: 1
enable-gcov:meson: enable-gcov:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
@ -401,7 +358,6 @@ scan-build:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
variables: variables:
NINJA_ARGS: 'scan-build' NINJA_ARGS: 'scan-build'
SKIP_MESON_TEST: 1
static-build:meson: static-build:meson:
extends: .fedora-custom-build@meson-template extends: .fedora-custom-build@meson-template
@ -412,7 +368,7 @@ static-build:meson:
soname: soname:
extends: extends:
- .fedora:31 - .{{custom_build_distro.name}}:{{custom_build_distro.versions|first()}}
stage: build stage: build
script: script:
- ./autogen.sh --prefix=$PWD/prefix-autotools/ - ./autogen.sh --prefix=$PWD/prefix-autotools/
@ -421,7 +377,7 @@ soname:
- meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/ - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
- ninja -C "$MESON_BUILDDIR" install - ninja -C "$MESON_BUILDDIR" install
- ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
needs: ['fedora:31@container-prep'] needs: ['{{custom_build_distro.name}}:{{custom_build_distro.versions|first()}}@container-prep']
################################################################# #################################################################
# # # #
@ -431,74 +387,59 @@ soname:
.check_tainted: &check_tainted | .check_tainted: &check_tainted |
# make sure the kernel is not tainted # make sure the kernel is not tainted
if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]]; if [[ "$(/app/vmctl exec cat /proc/sys/kernel/tainted)" -gt 0 ]];
then then
echo tainted kernel ; echo tainted kernel ;
exit 1 ; exit 1 ;
fi fi
.qemu@fedora:32: # build on the host, then run a systemd service to execute the test suite
# inside the qemu VM handled by b2c
.build-in-b2c@template:
extends: extends:
- .fedora:32 - .default_artifacts
stage: VM
image: $CI_REGISTRY_IMAGE/$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
tags: tags:
- kvm - kvm
variables: variables:
MESON_BUILDDIR: build_dir MESON_BUILDDIR: build_dir
B2C_KERNEL: {{ b2c.kernel }}
B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
B2C_COMMAND: .gitlab-ci/start-in-systemd.sh
script: script:
# start our vm, no args required # first build in the host container
- /app/start_vm.sh - .gitlab-ci/meson-build.sh --skip-test
- *check_tainted # pull b2c
- curl -L -o /app/boot2container https://gitlab.freedesktop.org/gfx-ci/boot2container/-/raw/{{b2c.version}}/vm2c.py
- chmod +x /app/boot2container
- "scp -P 5555 -r $PWD localhost:" # runs the test suite only
- echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv - /app/boot2container
- echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
- echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
- echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
- echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
- "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
- ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
# no matter the results of the tests, we want to fetch the logs
- scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
- *check_tainted
- ssh localhost -p 5555 halt || true
- sleep 2
- pkill qemu || true
- if [[ ! -e .success ]] ;
then
exit 1 ;
fi
artifacts:
name: "qemu-meson-logs-$CI_JOB_NAME"
when: always
expire_in: 1 week
paths:
- $MESON_BUILDDIR/meson-logs
- console.out
reports:
junit: $MESON_BUILDDIR/junit-*.xml
retry:
max: 2
when: script_failure
needs: ['fedora:32@qemu-prep']
{% for distro in distributions if distro.use_for_qemu_tests %}
{% set version = "{}".format(distro.versions|last()) %}
qemu:meson: qemu:meson:
extends: .qemu@fedora:32 stage: VM
extends:
- .fdo.distribution-image@{{distro.name}}
- .{{distro.name}}:{{version}}
- .build-in-b2c@template
needs:
- "{{distro.name}}:{{version}}@container-prep"
qemu:meson:valgrind: qemu:meson:valgrind:
extends: .qemu@fedora:32 extends:
- qemu:meson
variables: variables:
MESON_TEST_ARGS: '--setup=valgrind' MESON_TEST_ARGS: '--setup=valgrind'
{% endfor %}
{% for distro in distributions if distro.use_for_tarball_tests %}
{% set version = "{}".format(distro.versions|last()) %}
meson-from-tarball: meson-from-tarball:
extends: extends:
- .fedora:32 - .{{distro.name}}:{{version}}
stage: tarballs stage: tarballs
script: script:
- export INSTALLDIR="$PWD/_inst" - export INSTALLDIR="$PWD/_inst"
@ -506,26 +447,26 @@ meson-from-tarball:
- pushd _build > /dev/null - pushd _build > /dev/null
- ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
- make - make
- make distcheck - make dist
- popd > /dev/null - popd > /dev/null
- mkdir -p _tarball_dir - mkdir -p _tarball_dir
- tar xf _build/libevdev-*.tar.xz -C _tarball_dir - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
- pushd _tarball_dir/libevdev-*/ > /dev/null - pushd _tarball_dir/libevdev-*/ > /dev/null
- meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR" - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
- ninja -C "$MESON_BUILDDIR" test - meson test -C "$MESON_BUILDDIR" --no-suite="needs-uinput"
- ninja -C "$MESON_BUILDDIR" install - ninja -C "$MESON_BUILDDIR" install
- popd > /dev/null - popd > /dev/null
- ls -lR $INSTALLDIR - ls -lR $INSTALLDIR
needs: ['fedora:32@container-prep'] needs: ['{{distro.name}}:{{version}}@container-prep']
autotools-from-tarball: autotools-from-tarball:
extends: extends:
- .fedora:32 - .{{distro.name}}:{{version}}
stage: tarballs stage: tarballs
script: script:
- export INSTALLDIR="$PWD/_inst" - export INSTALLDIR="$PWD/_inst"
- meson "$MESON_BUILDDIR" - meson "$MESON_BUILDDIR"
- ninja -C "$MESON_BUILDDIR" dist - meson dist -C "$MESON_BUILDDIR" --no-tests
- mkdir -p _tarball_dir - mkdir -p _tarball_dir
- tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
- pushd _tarball_dir/libevdev-*/ > /dev/null - pushd _tarball_dir/libevdev-*/ > /dev/null
@ -538,4 +479,8 @@ autotools-from-tarball:
- popd > /dev/null - popd > /dev/null
- popd > /dev/null - popd > /dev/null
- ls -lR $INSTALLDIR - ls -lR $INSTALLDIR
needs: ['fedora:32@container-prep'] variables:
LIBEVDEV_SKIP_ROOT_TESTS: 1
needs: ['{{distro.name}}:{{version}}@container-prep']
{% endfor %}

View file

@ -3,14 +3,17 @@
# #
# We're happy to rebuild all containers when one changes. # We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2020-09-11.0' .default_tag: &default_tag '2024-11-25.0'
distributions: distributions:
- name: fedora - name: fedora
tag: *default_tag tag: *default_tag
use_for_tarball_tests: true
# only one distro for qemu tests
use_for_qemu_tests: true
versions: versions:
- '31' - '40'
- '32' - '41'
packages: packages:
- git - git
- gcc - gcc
@ -28,12 +31,18 @@ distributions:
- doxygen - doxygen
- xz - xz
- clang-analyzer - clang-analyzer
want_qemu: true # below packages are for the qemu runs, so optional
- systemd-udev
- qemu-img
- qemu-system-x86-core
- qemu-system-aarch64-core
- jq
- python3-click
- python3-rich
- name: ubuntu - name: ubuntu
tag: *default_tag tag: *default_tag
versions: versions:
- '20.04' - '24.10'
- '19.10'
packages: packages:
- git - git
- gcc - gcc
@ -71,37 +80,13 @@ distributions:
- binutils - binutils
- doxygen - doxygen
- xz-utils - xz-utils
- name: centos
tag: *default_tag
versions:
- '7'
- '8'
packages:
- git
- gcc
- gcc-c++
- automake
- autoconf
- libtool
- make
- pkgconfig
- python3
- check-devel
- valgrind
- binutils
- xz
build:
meson: False
extra_variables:
# note: the variable value includes the comment because we want that in the gitlab-ci file
MAKE_ARGS: "'' # disable distcheck, requires doxygen"
- name: arch - name: arch
tag: *default_tag tag: *default_tag
versions: versions:
- 'rolling' - 'rolling'
packages: packages:
- git - git
- gcc - gc
- meson - meson
- automake - automake
- autoconf - autoconf
@ -134,3 +119,7 @@ distributions:
- doxygen - doxygen
- xz - xz
- linux-headers - linux-headers
b2c:
version: 2ff65156ba67fa8a0c309a4fc16c5df1a88a3844
kernel: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v6.5/bzImage

View file

@ -1,9 +1,43 @@
#!/bin/bash #!/usr/bin/env bash
#
# This script is sourced from here:
# https://gitlab.freedesktop.org/whot/meson-helper
#
# SPDX-License-Identifier: MIT
set -x
if [[ -f .meson_environment ]]; then if [[ -f .meson_environment ]]; then
. .meson_environment . .meson_environment
fi fi
# If test args are set, we assume we want to run the tests
MESON_RUN_TEST="$MESON_TEST_ARGS"
while [[ $# -gt 0 ]]; do
case $1 in
--skip-setup)
shift
MESON_SKIP_SETUP="1"
;;
--skip-build)
shift
MESON_SKIP_BUILD="1"
;;
--skip-test)
shift
MESON_RUN_TEST=""
;;
--run-test)
shift
MESON_RUN_TEST="1"
;;
*)
echo "Unknow commandline argument $1"
exit 1
;;
esac
done
if [[ -z "$MESON_BUILDDIR" ]]; then if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR undefined." echo "\$MESON_BUILDDIR undefined."
exit 1 exit 1
@ -13,43 +47,42 @@ fi
# run and debug locally. # run and debug locally.
if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then
echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME". echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME".
CI_PROJECT_NAME=$(basename "$PWD")
CI_JOB_ID=$(date +%s) CI_JOB_ID=$(date +%s)
CI_JOB_NAME='libevdev-job-local' CI_JOB_NAME="$CI_PROJECT_NAME-job-local"
echo "Simulating gitlab environment: " echo "Simulating gitlab environment: "
echo " CI_JOB_ID=$CI_JOB_ID" echo " CI_JOB_ID=$CI_JOB_ID"
echo " CI_JOB_NAME=$CI_JOB_NAME" echo " CI_JOB_NAME=$CI_JOB_NAME"
fi fi
if [[ -n "$FDO_CI_CONCURRENT" ]]; then
jobcount="-j$FDO_CI_CONCURRENT"
export MESON_TESTTHREADS="$FDO_CI_CONCURRENT"
fi
echo "*************************************************" echo "*************************************************"
echo "builddir: $MESON_BUILDDIR" echo "builddir: $MESON_BUILDDIR"
echo "meson args: $MESON_ARGS" echo "meson args: $MESON_ARGS"
echo "ninja args: $NINJA_ARGS" echo "ninja args: $NINJA_ARGS"
echo "meson test args: $MESON_TEST_ARGS" echo "meson test args: $MESON_TEST_ARGS"
echo "job count: ${jobcount-0}"
echo "*************************************************" echo "*************************************************"
set -e set -e
rm -rf "$MESON_BUILDDIR" if [[ -z "$MESON_SKIP_SETUP" ]]; then
meson "$MESON_BUILDDIR" $MESON_ARGS rm -rf "$MESON_BUILDDIR"
meson setup "$MESON_BUILDDIR" $MESON_ARGS
fi
meson configure "$MESON_BUILDDIR" meson configure "$MESON_BUILDDIR"
ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
if [[ ! -z "$SKIP_MESON_TEST" ]]; then if [[ -z "$MESON_SKIP_BUILD" ]]; then
echo "Skipping meson test" if [[ -n "$NINJA_ARGS" ]]; then
exit 0 ninja_args="--ninja-args $NINJA_ARGS"
fi
meson compile -v -C "$MESON_BUILDDIR" $jobcount $ninja_args
fi fi
# we still want to generate the reports, even if meson test fails if [[ -n "$MESON_RUN_TEST" ]]; then
set +e meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs fi
exit_code=$?
set -e
# We need the glob for the testlog so that it picks up those suffixed by a
# suite (e.g. testlog-valgrind.json)
./.gitlab-ci/meson-junit-report.py \
--output="$MESON_BUILDDIR/junit-$CI_JOB_NAME-report.xml" \
"$MESON_BUILDDIR"/meson-logs/testlog*.json; \
exit $exit_code

View file

@ -1,128 +0,0 @@
#!/usr/bin/env python3
#
# meson-junit-report.py: Turns a Meson test log into a JUnit report
#
# Copyright 2019 GNOME Foundation
#
# SPDX-License-Identifier: LGPL-2.1-or-later
import argparse
import datetime
import json
import os
import sys
import xml.etree.ElementTree as ET
default_name = os.getenv('CI_PROJECT_NAME', 'unknown')
default_job_id = os.getenv('CI_JOB_ID', 'Unknown')
default_branch = os.getenv('CI_COMMIT_REF_NAME', 'master')
aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUnit report')
aparser.add_argument('--project-name', metavar='NAME',
help='The project name (default: $CI_PROJECT_NAME)',
default=default_name)
aparser.add_argument('--job-id', metavar='ID',
help='The job ID for the report (default: $CI_JOB_ID)',
default=default_job_id)
aparser.add_argument('--branch', metavar='NAME',
help='Branch of the project being tested',
default=default_branch)
aparser.add_argument('--output', metavar='FILE',
help='The output file, stdout by default',
type=argparse.FileType('w', encoding='UTF-8'),
default=sys.stdout)
aparser.add_argument('infile', metavar='FILE',
help='The input testlog.json, stdin by default',
type=argparse.FileType('r', encoding='UTF-8'),
default=sys.stdin)
args = aparser.parse_args()
outfile = args.output
testsuites = ET.Element('testsuites')
testsuites.set('id', '{}/{}'.format(args.job_id, args.branch))
testsuites.set('package', args.project_name)
testsuites.set('timestamp', datetime.datetime.utcnow().isoformat(timespec='minutes'))
suites = {}
for line in args.infile:
data = json.loads(line)
(full_suite, unit_name) = data['name'].split(' / ')
(project_name, suite_name) = full_suite.split(':')
duration = data['duration']
return_code = data['returncode']
log = data['stdout']
unit = {
'suite': suite_name,
'name': unit_name,
'duration': duration,
'returncode': return_code,
'stdout': log,
}
units = suites.setdefault(suite_name, [])
units.append(unit)
for name, units in suites.items():
print('Processing suite {} (units: {})'.format(name, len(units)))
def if_failed(unit):
if not if_skipped(unit) and unit['returncode'] != 0:
return True
return False
def if_skipped(unit):
if unit['returncode'] == 77:
return True
return False
def if_succeded(unit):
if unit['returncode'] == 0:
return True
return False
successes = list(filter(if_succeded, units))
failures = list(filter(if_failed, units))
skips = list(filter(if_skipped, units))
print(' - {}: {} pass, {} fail, {} skipped'.format(name, len(successes), len(failures), len(skips)))
testsuite = ET.SubElement(testsuites, 'testsuite')
testsuite.set('name', '{}/{}'.format(args.project_name, name))
testsuite.set('tests', str(len(units)))
testsuite.set('errors', str(len(failures)))
testsuite.set('skipped', str(len(skips)))
testsuite.set('failures', str(len(failures)))
for unit in successes:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('time', str(unit['duration']))
for unit in skips:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('time', str(unit['duration']))
skip = ET.SubElement(testcase, 'skipped')
for unit in failures:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('time', str(unit['duration']))
failure = ET.SubElement(testcase, 'failure')
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
failure.set('name', unit['name'])
failure.set('type', 'error')
failure.text = unit['stdout']
output = ET.tostring(testsuites, encoding='unicode')
outfile.write(output)

69
.gitlab-ci/start-in-systemd.sh Executable file
View file

@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -x
systemd_target=basic.target
post_command="/usr/bin/systemctl exit \$EXIT_STATUS"
while [[ $# -gt 0 ]]; do
case $1 in
--debug-mode)
shift
systemd_target=multi-user.target
post_command="echo you can now log in as root (no password) and then turn off by running \'/usr/bin/systemctl exit \$EXIT_STATUS\'"
;;
*)
echo "Unknow commandline argument $1"
exit 1
;;
esac
done
WORKDIR=${FDO_DISTRIBUTION_WORKINGDIR:-$PWD}
B2C_WORKDIR=${FDO_B2C_WORKDIR:-/app}
# remove root password for debugging
sed -i 's/root:!locked::/root:::/' /etc/shadow
# create a libevdev test suite service
cat <<EOF > /etc/systemd/system/libevdev-testsuite.service
[Unit]
Description=libevdev test suite
After=$systemd_target
[Service]
Type=simple
StandardOutput=journal+console
EnvironmentFile=$B2C_WORKDIR/.b2c_env
WorkingDirectory=$WORKDIR
ExecStart=$WORKDIR/.gitlab-ci/meson-build.sh --skip-setup --skip-build --run-test
# exit the container on termination
ExecStopPost=$post_command
[Install]
WantedBy=default.target
EOF
cat /etc/systemd/system/libevdev-testsuite.service
# enable the service
systemctl enable libevdev-testsuite.service
# disable some services we don't need in the CI
systemctl mask network-online.target
systemctl mask network-pre.target
systemctl mask timers.target
systemctl mask dnf-makecache.timer
systemctl mask systemd-logind.service
systemctl mask rpmdb-migrate.service
systemctl mask systemd-network-generator.service
systemctl mask cryptsetup-pre.target
systemctl mask cryptsetup.target
#change default target
systemctl set-default $systemd_target
# start the system
exec /usr/sbin/init

View file

@ -141,7 +141,7 @@ A [good commit message](http://who-t.blogspot.com/2009/12/on-commit-messages.htm
answer three questions: answer three questions:
- Why is it necessary? It may fix a bug, it may add a feature, it may - Why is it necessary? It may fix a bug, it may add a feature, it may
improve performance, reliabilty, stability, or just be a change for the improve performance, reliability, stability, or just be a change for the
sake of correctness. sake of correctness.
- How does it address the issue? For short obvious patches this part can be - How does it address the issue? For short obvious patches this part can be
omitted, but it should be a high level description of what the approach omitted, but it should be a high level description of what the approach

35
COPYING
View file

@ -1,23 +1,26 @@
SPDX-License-Identifier: MIT
Copyright © 2013 Red Hat, Inc. Copyright © 2013 Red Hat, Inc.
Copyright © 2013 David Herrmann <dh.herrmann@gmail.com> Copyright © 2013 David Herrmann <dh.herrmann@gmail.com>
Permission to use, copy, modify, distribute, and sell this software and its Permission is hereby granted, free of charge, to any person obtaining a copy
documentation for any purpose is hereby granted without fee, provided that of this software and associated documentation files (the "Software"), to
the above copyright notice appear in all copies and that both that copyright deal in the Software without restriction, including without limitation the
notice and this permission notice appear in supporting documentation, and rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
that the name of the copyright holders not be used in advertising or sell copies of the Software, and to permit persons to whom the Software is
publicity pertaining to distribution of the software without specific, furnished to do so, subject to the following conditions:
written prior permission. The copyright holders make no representations
about the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, The above copyright notice and this permission notice (including the next
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO paragraph) shall be included in all copies or substantial portions of the
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR Software.
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
OF THIS SOFTWARE. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
The following license is from a Linux kernel header file and there is no GPL The following license is from a Linux kernel header file and there is no GPL
code this package links to. code this package links to.

View file

@ -1,29 +1,14 @@
# SPDX-License-Identifier: MIT
#
# Copyright © 2013 Red Hat, Inc. # Copyright © 2013 Red Hat, Inc.
# #
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that copyright
# notice and this permission notice appear in supporting documentation, and
# that the name of the copyright holders not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. The copyright holders make no representations
# about the suitability of this software for any purpose. It is provided "as
# is" without express or implied warranty.
#
# THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
AC_PREREQ([2.62]) AC_PREREQ([2.62])
# change meson version too # change meson version too
AC_INIT([libevdev], AC_INIT([libevdev],
[1.10.0], [1.13.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=libevdev], [https://gitlab.freedesktop.org/libevdev/libevdev/issues/],
[libevdev], [libevdev],
[http://freedesktop.org/wiki/Software/libevdev/]) [http://freedesktop.org/wiki/Software/libevdev/])
@ -74,12 +59,9 @@ AC_CHECK_LIB([m], [round])
PKG_PROG_PKG_CONFIG() PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"]) PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
if test "x$HAVE_CHECK" = "xyes"; then if test "x$HAVE_CHECK" != "xyes"; then
AC_PATH_PROG(VALGRIND, [valgrind])
else
AC_MSG_WARN([check not found - skipping building unit tests]) AC_MSG_WARN([check not found - skipping building unit tests])
fi fi
AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(ENABLE_RUNTIME_TESTS, [test "x$HAVE_CHECK" = "xyes"]) AM_CONDITIONAL(ENABLE_RUNTIME_TESTS, [test "x$HAVE_CHECK" = "xyes"])
AM_CONDITIONAL(ENABLE_STATIC_LINK_TEST, [test "x$enable_static" = "xyes"]) AM_CONDITIONAL(ENABLE_STATIC_LINK_TEST, [test "x$enable_static" = "xyes"])

View file

@ -27,6 +27,7 @@
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
#define INPUT_PROP_MAX 0x1f #define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@ -278,7 +279,8 @@
#define KEY_PAUSECD 201 #define KEY_PAUSECD 201
#define KEY_PROG3 202 #define KEY_PROG3 202
#define KEY_PROG4 203 #define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */ #define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
#define KEY_SUSPEND 205 #define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */ #define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207 #define KEY_PLAY 207
@ -515,6 +517,10 @@
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
#define KEY_IMAGES 0x1ba /* AL Image Browser */ #define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0 #define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1 #define KEY_DEL_EOS 0x1c1
@ -542,6 +548,7 @@
#define KEY_FN_F 0x1e2 #define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3 #define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4 #define KEY_FN_B 0x1e4
#define KEY_FN_RIGHT_SHIFT 0x1e5
#define KEY_BRL_DOT1 0x1f1 #define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2 #define KEY_BRL_DOT2 0x1f2
@ -595,8 +602,14 @@
#define BTN_DPAD_LEFT 0x222 #define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223 #define BTN_DPAD_RIGHT 0x223
#define BTN_GRIPL 0x224
#define BTN_GRIPR 0x225
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */ #define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ #define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ #define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
@ -607,10 +620,29 @@
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ #define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */ #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
/*
* Keycodes for hotkeys toggling the electronic privacy screen found on some
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
* screen itself then the state should be reported through drm connecter props:
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
* Except when implementing the drm connecter properties API is not possible
* because e.g. the firmware does not allow querying the presence and/or status
* of the eprivacy screen at boot.
*/
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260 #define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261 #define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262 #define KEY_KBDINPUTASSIST_PREVGROUP 0x262
@ -655,6 +687,27 @@
/* Select an area of screen to be copied */ /* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a #define KEY_SELECTIVE_SCREENSHOT 0x27a
/* Move the focus to the next or previous user controllable element within a UI container */
#define KEY_NEXT_ELEMENT 0x27b
#define KEY_PREVIOUS_ELEMENT 0x27c
/* Toggle Autopilot engagement */
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
/* Shortcut Keys */
#define KEY_MARK_WAYPOINT 0x27e
#define KEY_SOS 0x27f
#define KEY_NAV_CHART 0x280
#define KEY_FISHING_CHART 0x281
#define KEY_SINGLE_RANGE_RADAR 0x282
#define KEY_DUAL_RANGE_RADAR 0x283
#define KEY_RADAR_OVERLAY 0x284
#define KEY_TRADITIONAL_SONAR 0x285
#define KEY_CLEARVU_SONAR 0x286
#define KEY_SIDEVU_SONAR 0x287
#define KEY_NAV_INFO 0x288
#define KEY_BRIGHTNESS_MENU 0x289
/* /*
* Some keyboards have keys which do not have a defined meaning, these keys * Some keyboards have keys which do not have a defined meaning, these keys
* are intended to be programmed / bound to macros by the user. For most * are intended to be programmed / bound to macros by the user. For most
@ -730,6 +783,9 @@
#define KEY_KBD_LCD_MENU4 0x2bb #define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc #define KEY_KBD_LCD_MENU5 0x2bc
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1 #define BTN_TRIGGER_HAPPY2 0x2c1
@ -834,6 +890,7 @@
#define ABS_TOOL_WIDTH 0x1c #define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20 #define ABS_VOLUME 0x20
#define ABS_PROFILE 0x21
#define ABS_MISC 0x28 #define ABS_MISC 0x28
@ -889,7 +946,8 @@
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MACHINE_COVER 0x10 /* set = cover closed */ #define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_MAX 0x10 #define SW_USB_INSERT 0x11 /* set = USB audio device connected */
#define SW_MAX 0x11
#define SW_CNT (SW_MAX+1) #define SW_CNT (SW_MAX+1)
/* /*

View file

@ -27,6 +27,7 @@
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
#define INPUT_PROP_MAX 0x1f #define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@ -278,7 +279,8 @@
#define KEY_PAUSECD 201 #define KEY_PAUSECD 201
#define KEY_PROG3 202 #define KEY_PROG3 202
#define KEY_PROG4 203 #define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */ #define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
#define KEY_SUSPEND 205 #define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */ #define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207 #define KEY_PLAY 207
@ -515,6 +517,10 @@
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
#define KEY_IMAGES 0x1ba /* AL Image Browser */ #define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0 #define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1 #define KEY_DEL_EOS 0x1c1
@ -542,6 +548,7 @@
#define KEY_FN_F 0x1e2 #define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3 #define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4 #define KEY_FN_B 0x1e4
#define KEY_FN_RIGHT_SHIFT 0x1e5
#define KEY_BRL_DOT1 0x1f1 #define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2 #define KEY_BRL_DOT2 0x1f2
@ -595,8 +602,14 @@
#define BTN_DPAD_LEFT 0x222 #define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223 #define BTN_DPAD_RIGHT 0x223
#define BTN_GRIPL 0x224
#define BTN_GRIPR 0x225
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */ #define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ #define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ #define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
@ -607,10 +620,29 @@
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ #define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */ #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
/*
* Keycodes for hotkeys toggling the electronic privacy screen found on some
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
* screen itself then the state should be reported through drm connecter props:
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
* Except when implementing the drm connecter properties API is not possible
* because e.g. the firmware does not allow querying the presence and/or status
* of the eprivacy screen at boot.
*/
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260 #define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261 #define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262 #define KEY_KBDINPUTASSIST_PREVGROUP 0x262
@ -655,6 +687,27 @@
/* Select an area of screen to be copied */ /* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a #define KEY_SELECTIVE_SCREENSHOT 0x27a
/* Move the focus to the next or previous user controllable element within a UI container */
#define KEY_NEXT_ELEMENT 0x27b
#define KEY_PREVIOUS_ELEMENT 0x27c
/* Toggle Autopilot engagement */
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
/* Shortcut Keys */
#define KEY_MARK_WAYPOINT 0x27e
#define KEY_SOS 0x27f
#define KEY_NAV_CHART 0x280
#define KEY_FISHING_CHART 0x281
#define KEY_SINGLE_RANGE_RADAR 0x282
#define KEY_DUAL_RANGE_RADAR 0x283
#define KEY_RADAR_OVERLAY 0x284
#define KEY_TRADITIONAL_SONAR 0x285
#define KEY_CLEARVU_SONAR 0x286
#define KEY_SIDEVU_SONAR 0x287
#define KEY_NAV_INFO 0x288
#define KEY_BRIGHTNESS_MENU 0x289
/* /*
* Some keyboards have keys which do not have a defined meaning, these keys * Some keyboards have keys which do not have a defined meaning, these keys
* are intended to be programmed / bound to macros by the user. For most * are intended to be programmed / bound to macros by the user. For most
@ -730,6 +783,9 @@
#define KEY_KBD_LCD_MENU4 0x2bb #define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc #define KEY_KBD_LCD_MENU5 0x2bc
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1 #define BTN_TRIGGER_HAPPY2 0x2c1
@ -834,6 +890,7 @@
#define ABS_TOOL_WIDTH 0x1c #define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20 #define ABS_VOLUME 0x20
#define ABS_PROFILE 0x21
#define ABS_MISC 0x28 #define ABS_MISC 0x28
@ -889,7 +946,8 @@
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MACHINE_COVER 0x10 /* set = cover closed */ #define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_MAX 0x10 #define SW_USB_INSERT 0x11 /* set = USB audio device connected */
#define SW_MAX 0x11
#define SW_CNT (SW_MAX+1) #define SW_CNT (SW_MAX+1)
/* /*

View file

@ -6,14 +6,16 @@
* under the terms of the GNU General Public License version 2 as published by * under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#ifndef _INPUT_H #ifndef _UAPI_INPUT_H
#define _INPUT_H #define _UAPI_INPUT_H
#ifndef __KERNEL__
#include <sys/time.h> #include <sys/time.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>
#include <linux/types.h> #include <linux/types.h>
#endif
#include "input-event-codes.h" #include "input-event-codes.h"
@ -76,13 +78,16 @@ struct input_id {
* Note that input core does not clamp reported values to the * Note that input core does not clamp reported values to the
* [minimum, maximum] limits, such task is left to userspace. * [minimum, maximum] limits, such task is left to userspace.
* *
* The default resolution for main axes (ABS_X, ABS_Y, ABS_Z) * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z,
* is reported in units per millimeter (units/mm), resolution * ABS_MT_POSITION_X, ABS_MT_POSITION_Y) is reported in units
* for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported * per millimeter (units/mm), resolution for rotational axes
* in units per radian. * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
* The resolution for the size axes (ABS_MT_TOUCH_MAJOR,
* ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MAJOR, ABS_MT_WIDTH_MINOR)
* is reported in units per millimeter (units/mm).
* When INPUT_PROP_ACCELEROMETER is set the resolution changes. * When INPUT_PROP_ACCELEROMETER is set the resolution changes.
* The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in
* in units per g (units/g) and in units per degree per second * units per g (units/g) and in units per degree per second
* (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ). * (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ).
*/ */
struct input_absinfo { struct input_absinfo {
@ -269,6 +274,8 @@ struct input_mask {
#define BUS_RMI 0x1D #define BUS_RMI 0x1D
#define BUS_CEC 0x1E #define BUS_CEC 0x1E
#define BUS_INTEL_ISHTP 0x1F #define BUS_INTEL_ISHTP 0x1F
#define BUS_AMD_SFH 0x20
#define BUS_SDW 0x21
/* /*
* MT_TOOL types * MT_TOOL types
@ -422,6 +429,24 @@ struct ff_rumble_effect {
__u16 weak_magnitude; __u16 weak_magnitude;
}; };
/**
* struct ff_haptic_effect
* @hid_usage: hid_usage according to Haptics page (WAVEFORM_CLICK, etc.)
* @vendor_id: the waveform vendor ID if hid_usage is in the vendor-defined range
* @vendor_waveform_page: the vendor waveform page if hid_usage is in the vendor-defined range
* @intensity: strength of the effect as percentage
* @repeat_count: number of times to retrigger effect
* @retrigger_period: time before effect is retriggered (in ms)
*/
struct ff_haptic_effect {
__u16 hid_usage;
__u16 vendor_id;
__u8 vendor_waveform_page;
__u16 intensity;
__u16 repeat_count;
__u16 retrigger_period;
};
/** /**
* struct ff_effect - defines force feedback effect * struct ff_effect - defines force feedback effect
* @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
@ -458,6 +483,7 @@ struct ff_effect {
struct ff_periodic_effect periodic; struct ff_periodic_effect periodic;
struct ff_condition_effect condition[2]; /* One for each axis */ struct ff_condition_effect condition[2]; /* One for each axis */
struct ff_rumble_effect rumble; struct ff_rumble_effect rumble;
struct ff_haptic_effect haptic;
} u; } u;
}; };
@ -465,6 +491,7 @@ struct ff_effect {
* Force feedback effect types * Force feedback effect types
*/ */
#define FF_HAPTIC 0x4f
#define FF_RUMBLE 0x50 #define FF_RUMBLE 0x50
#define FF_PERIODIC 0x51 #define FF_PERIODIC 0x51
#define FF_CONSTANT 0x52 #define FF_CONSTANT 0x52
@ -474,7 +501,7 @@ struct ff_effect {
#define FF_INERTIA 0x56 #define FF_INERTIA 0x56
#define FF_RAMP 0x57 #define FF_RAMP 0x57
#define FF_EFFECT_MIN FF_RUMBLE #define FF_EFFECT_MIN FF_HAPTIC
#define FF_EFFECT_MAX FF_RAMP #define FF_EFFECT_MAX FF_RAMP
/* /*
@ -509,4 +536,4 @@ struct ff_effect {
#define FF_MAX 0x7f #define FF_MAX 0x7f
#define FF_CNT (FF_MAX+1) #define FF_CNT (FF_MAX+1)
#endif /* _INPUT_H */ #endif /* _UAPI_INPUT_H */

View file

@ -33,7 +33,7 @@ event-names.h: Makefile make-event-names.py
$(PYTHON) $(srcdir)/make-event-names.py $(top_srcdir)/include/linux/@OS@/input.h $(top_srcdir)/include/linux/@OS@/input-event-codes.h > $@ $(PYTHON) $(srcdir)/make-event-names.py $(top_srcdir)/include/linux/@OS@/input.h $(top_srcdir)/include/linux/@OS@/input-event-codes.h > $@
EXTRA_DIST = make-event-names.py libevdev.sym EXTRA_DIST = make-event-names.py libevdev.sym ../include
CLEANFILES = event-names.h CLEANFILES = event-names.h
BUILT_SOURCES = event-names.h BUILT_SOURCES = event-names.h

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#ifndef LIBEVDEV_INT_H #ifndef LIBEVDEV_INT_H

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 David Herrmann <dh.herrmann@gmail.com> * Copyright © 2013 David Herrmann <dh.herrmann@gmail.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
struct libevdev_uinput { struct libevdev_uinput {

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"
@ -185,7 +168,7 @@ libevdev_uinput_get_fd(const struct libevdev_uinput *uinput_dev)
* FreeBSD does not have anything similar to sysfs. * FreeBSD does not have anything similar to sysfs.
* Set libevdev_uinput->syspath to NULL unconditionally. * Set libevdev_uinput->syspath to NULL unconditionally.
* Look up the device nodes directly instead of via sysfs, as this matches what * Look up the device nodes directly instead of via sysfs, as this matches what
* is returned by the UI_GET_SYSNAME ioctl() on FreeBSD. * is returned by the UI_GET_SYSNAME ioctl() on FreeBSD.
*/ */
static int static int
fetch_syspath_and_devnode(struct libevdev_uinput *uinput_dev) fetch_syspath_and_devnode(struct libevdev_uinput *uinput_dev)
@ -485,7 +468,13 @@ libevdev_uinput_write_event(const struct libevdev_uinput *uinput_dev,
unsigned int code, unsigned int code,
int value) int value)
{ {
struct input_event ev = { {0,0}, type, code, value }; struct input_event ev = {
.input_event_sec = 0,
.input_event_usec = 0,
.type = type,
.code = code,
.value = value
};
int fd = libevdev_uinput_get_fd(uinput_dev); int fd = libevdev_uinput_get_fd(uinput_dev);
int rc, max; int rc, max;

View file

@ -1,23 +1,25 @@
/* SPDX-License-Identifier: MIT */
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission is hereby granted, free of charge, to any person obtaining a copy
* documentation for any purpose is hereby granted without fee, provided that * of this software and associated documentation files (the "Software"), to
* the above copyright notice appear in all copies and that both that copyright * deal in the Software without restriction, including without limitation the
* notice and this permission notice appear in supporting documentation, and * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* that the name of the copyright holders not be used in advertising or * sell copies of the Software, and to permit persons to whom the Software is
* publicity pertaining to distribution of the software without specific, * furnished to do so, subject to the following conditions:
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
* *
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * The above copyright notice and this permission notice (including the next
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * paragraph) shall be included in all copies or substantial portions of the
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * Software.
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, *
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* OF THIS SOFTWARE. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/ */
#ifndef LIBEVDEV_UINPUT_H #ifndef LIBEVDEV_UINPUT_H
@ -40,14 +42,13 @@ struct libevdev_uinput;
* *
* @code * @code
* int err; * int err;
* int fd, new_fd, uifd; * int fd, uifd;
* struct libevdev *dev; * struct libevdev *dev;
* struct libevdev_uinput *uidev; * struct libevdev_uinput *uidev;
* struct input_event ev[2];
* *
* fd = open("/dev/input/event0", O_RDONLY); * fd = open("/dev/input/event0", O_RDONLY);
* if (fd < 0) * if (fd < 0)
* return err; * return -errno;
* *
* err = libevdev_new_from_fd(fd, &dev); * err = libevdev_new_from_fd(fd, &dev);
* if (err != 0) * if (err != 0)
@ -65,7 +66,7 @@ struct libevdev_uinput;
* err = libevdev_uinput_write_event(uidev, EV_REL, REL_X, -1); * err = libevdev_uinput_write_event(uidev, EV_REL, REL_X, -1);
* if (err != 0) * if (err != 0)
* return err; * return err;
* libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0); * err = libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
* if (err != 0) * if (err != 0)
* return err; * return err;
* *
@ -107,7 +108,7 @@ struct libevdev_uinput;
*/ */
enum libevdev_uinput_open_mode { enum libevdev_uinput_open_mode {
/* intentionally -2 to avoid to avoid code like the below from accidentally working: /* intentionally -2 to avoid code like below from accidentally working:
fd = open("/dev/uinput", O_RDWR); // fails, fd is -1 fd = open("/dev/uinput", O_RDWR); // fails, fd is -1
libevdev_uinput_create_from_device(dev, fd, &uidev); // may hide the error */ libevdev_uinput_create_from_device(dev, fd, &uidev); // may hide the error */
LIBEVDEV_UINPUT_OPEN_MANAGED = -2 /**< let libevdev open and close @c /dev/uinput */ LIBEVDEV_UINPUT_OPEN_MANAGED = -2 /**< let libevdev open and close @c /dev/uinput */
@ -186,7 +187,7 @@ int libevdev_uinput_get_fd(const struct libevdev_uinput *uinput_dev);
* @ingroup uinput * @ingroup uinput
* *
* Return the syspath representing this uinput device. If the UI_GET_SYSNAME * Return the syspath representing this uinput device. If the UI_GET_SYSNAME
* ioctl not available, libevdev makes an educated guess. * ioctl is not available, libevdev makes an educated guess.
* The UI_GET_SYSNAME ioctl is available since Linux 3.15. * The UI_GET_SYSNAME ioctl is available since Linux 3.15.
* *
* The syspath returned is the one of the input node itself * The syspath returned is the one of the input node itself
@ -195,8 +196,8 @@ int libevdev_uinput_get_fd(const struct libevdev_uinput *uinput_dev);
* *
* @note This function may return NULL if UI_GET_SYSNAME is not available. * @note This function may return NULL if UI_GET_SYSNAME is not available.
* In that case, libevdev uses ctime and the device name to guess devices. * In that case, libevdev uses ctime and the device name to guess devices.
* To avoid false positives, wait at least wait at least 1.5s between * To avoid false positives, wait at least 1.5s between creating devices that
* creating devices that have the same name. * have the same name.
* *
* @note FreeBSD does not have sysfs, on FreeBSD this function always returns * @note FreeBSD does not have sysfs, on FreeBSD this function always returns
* NULL. * NULL.
@ -219,7 +220,7 @@ const char* libevdev_uinput_get_syspath(struct libevdev_uinput *uinput_dev);
* @note This function may return NULL. libevdev may have to guess the * @note This function may return NULL. libevdev may have to guess the
* syspath and the device node. See libevdev_uinput_get_syspath() for details. * syspath and the device node. See libevdev_uinput_get_syspath() for details.
* *
* @note On FreeBSD, this function can not return NULL. libudev uses the * @note On FreeBSD, this function can not return NULL. libudev uses the
* UI_GET_SYSNAME ioctl to get the device node on this platform and if that * UI_GET_SYSNAME ioctl to get the device node on this platform and if that
* fails, the call to libevdev_uinput_create_from_device() fails. * fails, the call to libevdev_uinput_create_from_device() fails.
* *

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#ifndef _UTIL_H_ #ifndef _UTIL_H_
@ -59,19 +42,19 @@ startswith(const char *str, size_t len, const char *prefix, size_t plen)
static inline int static inline int
bit_is_set(const unsigned long *array, int bit) bit_is_set(const unsigned long *array, int bit)
{ {
return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS))); return !!(array[bit / LONG_BITS] & (1ULL << (bit % LONG_BITS)));
} }
static inline void static inline void
set_bit(unsigned long *array, int bit) set_bit(unsigned long *array, int bit)
{ {
array[bit / LONG_BITS] |= (1LL << (bit % LONG_BITS)); array[bit / LONG_BITS] |= (1ULL << (bit % LONG_BITS));
} }
static inline void static inline void
clear_bit(unsigned long *array, int bit) clear_bit(unsigned long *array, int bit)
{ {
array[bit / LONG_BITS] &= ~(1LL << (bit % LONG_BITS)); array[bit / LONG_BITS] &= ~(1ULL << (bit % LONG_BITS));
} }
static inline void static inline void

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"
@ -61,7 +44,8 @@ struct slot_change_state {
}; };
static int sync_mt_state(struct libevdev *dev, static int sync_mt_state(struct libevdev *dev,
struct slot_change_state *changes_out); struct slot_change_state changes_out[dev->num_slots]);
static int static int
update_key_state(struct libevdev *dev, const struct input_event *e); update_key_state(struct libevdev *dev, const struct input_event *e);
@ -821,23 +805,34 @@ push_mt_sync_events(struct libevdev *dev,
int rc; int rc;
for (int slot = 0; slot < dev->num_slots; slot++) { for (int slot = 0; slot < dev->num_slots; slot++) {
/* stopped touches were already terminated in bool have_slot_event = false;
* terminate_slots */
if (changes[slot].state == TOUCH_STOPPED ||
!bit_is_set(changes[slot].axes, ABS_MT_SLOT))
continue;
queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot); if (!bit_is_set(changes[slot].axes, ABS_MT_SLOT))
last_reported_slot = slot; continue;
for (int axis = ABS_MT_MIN; axis <= ABS_MT_MAX; axis++) { for (int axis = ABS_MT_MIN; axis <= ABS_MT_MAX; axis++) {
if (axis == ABS_MT_SLOT || if (axis == ABS_MT_SLOT ||
!libevdev_has_event_code(dev, EV_ABS, axis)) !libevdev_has_event_code(dev, EV_ABS, axis))
continue; continue;
if (bit_is_set(changes[slot].axes, axis)) if (bit_is_set(changes[slot].axes, axis)) {
/* We already sent the tracking id -1 in
* terminate_slots so don't do that again. There
* may be other axes like ABS_MT_TOOL_TYPE that
* need to be synced despite no touch being active */
if (axis == ABS_MT_TRACKING_ID &&
*slot_value(dev, slot, axis) == -1)
continue;
if (!have_slot_event) {
queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
last_reported_slot = slot;
have_slot_event = true;
}
queue_push_event(dev, EV_ABS, axis, queue_push_event(dev, EV_ABS, axis,
*slot_value(dev, slot, axis)); *slot_value(dev, slot, axis));
}
} }
} }
@ -927,7 +922,8 @@ sync_state(struct libevdev *dev)
bool want_mt_sync = false; bool want_mt_sync = false;
int last_reported_slot = 0; int last_reported_slot = 0;
struct slot_change_state changes[dev->num_slots > 0 ? dev->num_slots : 1]; struct slot_change_state changes[dev->num_slots > 0 ? dev->num_slots : 1];
memset(changes, 0, sizeof(changes));
memset(changes, 0, sizeof(changes));
/* see section "Discarding events before synchronizing" in /* see section "Discarding events before synchronizing" in
* libevdev/libevdev.h */ * libevdev/libevdev.h */

View file

@ -1,23 +1,26 @@
/* SPDX-License-Identifier: MIT */
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission is hereby granted, free of charge, to any person obtaining a copy
* documentation for any purpose is hereby granted without fee, provided that * of this software and associated documentation files (the "Software"), to
* the above copyright notice appear in all copies and that both that copyright * deal in the Software without restriction, including without limitation the
* notice and this permission notice appear in supporting documentation, and * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* that the name of the copyright holders not be used in advertising or * sell copies of the Software, and to permit persons to whom the Software is
* publicity pertaining to distribution of the software without specific, * furnished to do so, subject to the following conditions:
* written prior permission. The copyright holders make no representations *
* about the suitability of this software for any purpose. It is provided "as * The above copyright notice and this permission notice (including the next
* is" without express or implied warranty. * paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
* *
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#ifndef LIBEVDEV_H #ifndef LIBEVDEV_H
@ -160,7 +163,7 @@ extern "C" {
* License information * License information
* =================== * ===================
* libevdev is licensed under the * libevdev is licensed under the
* [X11 license](http://cgit.freedesktop.org/libevdev/tree/COPYING). * [MIT license](http://cgit.freedesktop.org/libevdev/tree/COPYING).
* *
* Bindings * Bindings
* =================== * ===================
@ -497,11 +500,11 @@ extern "C" {
* <dd>supported, see libevdev_enable_event_code()</dd> * <dd>supported, see libevdev_enable_event_code()</dd>
* <dt>EVIOCGKEYCODE:</dt> * <dt>EVIOCGKEYCODE:</dt>
* <dd>currently not supported</dd> * <dd>currently not supported</dd>
* <dt>EVIOCGKEYCODE:</dt>
* <dd>currently not supported</dd>
* <dt>EVIOCSKEYCODE:</dt> * <dt>EVIOCSKEYCODE:</dt>
* <dd>currently not supported</dd> * <dd>currently not supported</dd>
* <dt>EVIOCSKEYCODE:</dt> * <dt>EVIOCGKEYCODE_V2:</dt>
* <dd>currently not supported</dd>
* <dt>EVIOCSKEYCODE_V2:</dt>
* <dd>currently not supported</dd> * <dd>currently not supported</dd>
* <dt>EVIOCGNAME:</dt> * <dt>EVIOCGNAME:</dt>
* <dd>supported, see libevdev_get_name()</dd> * <dd>supported, see libevdev_get_name()</dd>
@ -541,6 +544,10 @@ extern "C" {
* <dt>EVIOCREVOKE:</dt> * <dt>EVIOCREVOKE:</dt>
* <dd>currently not supported, see * <dd>currently not supported, see
* http://lists.freedesktop.org/archives/input-tools/2014-January/000688.html</dd> * http://lists.freedesktop.org/archives/input-tools/2014-January/000688.html</dd>
* <dt>EVIOCGMASK:</dt>
* <dd>currently not supported</dd>
* <dt>EVIOCSMASK:</dt>
* <dd>currently not supported</dd>
* </dl> * </dl>
* *
*/ */
@ -631,7 +638,7 @@ extern "C" {
* return ENOMEM; * return ENOMEM;
* *
* err = libevdev_set_fd(dev, fd); * err = libevdev_set_fd(dev, fd);
* if (err < 0) { * if (err < 0)
* printf("Failed (errno %d): %s\n", -err, strerror(-err)); * printf("Failed (errno %d): %s\n", -err, strerror(-err));
* *
* libevdev_free(dev); * libevdev_free(dev);
@ -1515,8 +1522,7 @@ const struct input_absinfo* libevdev_get_abs_info(const struct libevdev *dev, un
* the event. * the event.
* *
* If the device supports ABS_MT_SLOT, the value returned for any ABS_MT_* * If the device supports ABS_MT_SLOT, the value returned for any ABS_MT_*
* event code is the value of the currently active slot. You should use * event code is undefined. Use libevdev_get_slot_value() instead.
* libevdev_get_slot_value() instead.
* *
* @param dev The evdev device, already initialized with libevdev_set_fd() * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param type The event type for the code to query (EV_SYN, EV_REL, etc.) * @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
@ -1557,8 +1563,7 @@ int libevdev_get_event_value(const struct libevdev *dev, unsigned int type, unsi
* *
* @return 0 on success, or -1 on failure. * @return 0 on success, or -1 on failure.
* @retval -1 * @retval -1
* - the device does not have the event type or * - the device does not have the event type or code enabled, or
* - code enabled, or the code is outside the, or
* - the code is outside the allowed limits for the given type, or * - the code is outside the allowed limits for the given type, or
* - the type cannot be set, or * - the type cannot be set, or
* - the value is not permitted for the given code. * - the value is not permitted for the given code.

View file

@ -1,23 +1,6 @@
/* SPDX-License-Identifier: MIT */
/* /*
* Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> * Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
LIBEVDEV_1 { LIBEVDEV_1 {

View file

@ -70,10 +70,10 @@ def print_bits(bits, prefix):
if not hasattr(bits, prefix): if not hasattr(bits, prefix):
return return
print("static const char * const %s_map[%s_MAX + 1] = {" % (prefix, prefix.upper())) print("static const char * const %s_map[%s_MAX + 1] = {" % (prefix, prefix.upper()))
for val, name in list(getattr(bits, prefix).items()): for val, name in sorted(list(getattr(bits, prefix).items())):
print(" [%s] = \"%s\"," % (name, name)) print(" [%s] = \"%s\"," % (name, name))
if prefix == "key": if prefix == "key":
for val, name in list(getattr(bits, "btn").items()): for val, name in sorted(list(getattr(bits, "btn").items())):
print(" [%s] = \"%s\"," % (name, name)) print(" [%s] = \"%s\"," % (name, name))
print("};") print("};")
print("") print("")
@ -118,7 +118,7 @@ def print_lookup(bits, prefix):
if not hasattr(bits, prefix): if not hasattr(bits, prefix):
return return
names = list(getattr(bits, prefix).items()) names = sorted(list(getattr(bits, prefix).items()))
if prefix == "btn": if prefix == "btn":
names = names + btn_additional names = names + btn_additional

View file

@ -1,13 +1,14 @@
project('libevdev', 'c', project('libevdev', 'c',
version: '1.10.0', # change autotools version too version: '1.13.6', # change autotools version too
license: 'MIT/Expat', license: 'MIT/Expat',
default_options: [ 'c_std=gnu99', 'warning_level=2' ], default_options: [ 'c_std=gnu99', 'warning_level=2' ],
meson_version: '>= 0.47.0') meson_version: '>= 0.56.0')
libevdev_version = meson.project_version().split('.') libevdev_version = meson.project_version().split('.')
dir_src = join_paths(meson.source_root(), 'libevdev') dir_root = meson.project_source_root()
dir_src_test = join_paths(meson.source_root(), 'test') dir_src = dir_root / 'libevdev'
dir_src_test = dir_root / 'test'
# Include directories # Include directories
includes_include = include_directories('include') includes_include = include_directories('include')
@ -37,10 +38,10 @@ config_h.set('_GNU_SOURCE', '1')
# Dependencies # Dependencies
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
dep_lm = cc.find_library('m') dep_lm = cc.find_library('m')
dep_rt = cc.find_library('rt')
input_h = join_paths(meson.source_root(), 'include', 'linux', host_machine.system(), 'input.h') input_h = dir_root / 'include' / 'linux' / host_machine.system() / 'input.h'
uinput_h = join_paths(meson.source_root(), 'include', 'linux', host_machine.system(), 'uinput.h') input_event_codes_h = dir_root / 'include' / 'linux' / host_machine.system() / 'input-event-codes.h'
input_event_codes_h = join_paths(meson.source_root(), 'include', 'linux', host_machine.system(), 'input-event-codes.h')
# event-names.h # event-names.h
make_event_names = find_program('libevdev/make-event-names.py') make_event_names = find_program('libevdev/make-event-names.py')
@ -54,8 +55,7 @@ event_names_h = configure_file(input: 'libevdev/libevdev.h',
install_headers('libevdev/libevdev.h', install_headers('libevdev/libevdev.h',
'libevdev/libevdev-uinput.h', 'libevdev/libevdev-uinput.h',
subdir: 'libevdev-1.0/libevdev') subdir: 'libevdev-1.0/libevdev')
src_libevdev = [ src_libevdev = [event_names_h] + files(
event_names_h,
'libevdev/libevdev.h', 'libevdev/libevdev.h',
'libevdev/libevdev-int.h', 'libevdev/libevdev-int.h',
'libevdev/libevdev-util.h', 'libevdev/libevdev-util.h',
@ -66,24 +66,23 @@ src_libevdev = [
'libevdev/libevdev-names.c', 'libevdev/libevdev-names.c',
'include/linux/input.h', 'include/linux/input.h',
'include/linux/uinput.h', 'include/linux/uinput.h',
input_event_codes_h, )
input_h,
uinput_h
]
mapfile = join_paths(dir_src, 'libevdev.sym') mapfile = dir_src / 'libevdev.sym'
version_flag = '-Wl,--version-script,@0@'.format(mapfile) version_flag = '-Wl,--version-script,@0@'.format(mapfile)
lib_libevdev = library('evdev', lib_libevdev = library('evdev',
src_libevdev, src_libevdev,
include_directories: [includes_include], include_directories: [includes_include],
dependencies: [], dependencies: [dep_rt],
version: libevdev_so_version, version: libevdev_so_version,
link_args: version_flag, link_args: version_flag,
link_depends: mapfile, link_depends: mapfile,
install: true install: true
) )
dep_libevdev = declare_dependency(link_with: lib_libevdev) inc_libevdev = include_directories('.')
dep_libevdev = declare_dependency(link_with: lib_libevdev,
include_directories: [inc_libevdev])
pkgconfig.generate( pkgconfig.generate(
filebase: 'libevdev', filebase: 'libevdev',
@ -103,28 +102,36 @@ install_man(manpage)
# tools # tools
executable('libevdev-events', if not get_option('tools').disabled()
sources: ['tools/libevdev-events.c'], executable('libevdev-events',
include_directories: [includes_include], sources: ['tools/libevdev-events.c'],
dependencies: dep_libevdev, include_directories: [includes_include],
install: false) dependencies: dep_libevdev,
executable('touchpad-edge-detector', install: false)
sources: ['tools/touchpad-edge-detector.c'], executable('libevdev-list-codes',
include_directories: [includes_include], sources: ['tools/libevdev-list-codes.c'],
dependencies: [dep_libevdev, dep_lm], include_directories: [includes_include],
install: true) dependencies: dep_libevdev,
executable('mouse-dpi-tool', install: false)
sources: ['tools/mouse-dpi-tool.c'], executable('touchpad-edge-detector',
include_directories: [includes_include], sources: ['tools/touchpad-edge-detector.c'],
dependencies: dep_libevdev, include_directories: [includes_include],
install: true) dependencies: [dep_libevdev, dep_lm],
executable('libevdev-tweak-device', install: true)
sources: ['tools/libevdev-tweak-device.c'], executable('mouse-dpi-tool',
include_directories: [includes_include], sources: ['tools/mouse-dpi-tool.c'],
dependencies: dep_libevdev, include_directories: [includes_include],
install: true) dependencies: dep_libevdev,
install_man('tools/libevdev-tweak-device.1', install: true)
'tools/touchpad-edge-detector.1') executable('libevdev-tweak-device',
sources: ['tools/libevdev-tweak-device.c'],
include_directories: [includes_include],
dependencies: dep_libevdev,
install: true)
install_man('tools/libevdev-tweak-device.1',
'tools/touchpad-edge-detector.1',
'tools/mouse-dpi-tool.1')
endif
# tests # tests
dep_check = dependency('check', version: '>= 0.9.9', dep_check = dependency('check', version: '>= 0.9.9',
@ -158,7 +165,7 @@ if dep_check.found()
include_directories: [includes_include], include_directories: [includes_include],
dependencies: [dep_libevdev, dep_check], dependencies: [dep_libevdev, dep_check],
install: false) install: false)
test('test-event-codes', test_event_codes, suite: 'library') test('test-event-codes', test_event_codes, suite: ['library', 'needs-uinput'])
test_internals = executable('test-internals', test_internals = executable('test-internals',
sources: src_common + [ sources: src_common + [
@ -167,7 +174,7 @@ if dep_check.found()
include_directories: [includes_include], include_directories: [includes_include],
dependencies: [dep_libevdev, dep_check], dependencies: [dep_libevdev, dep_check],
install: false) install: false)
test('test-internals', test_internals, suite: 'library') test('test-internals', test_internals, suite: ['library', 'needs-uinput'])
test_uinput = executable('test-uinput', test_uinput = executable('test-uinput',
sources: src_common + [ sources: src_common + [
@ -176,7 +183,7 @@ if dep_check.found()
include_directories: [includes_include], include_directories: [includes_include],
dependencies: [dep_libevdev, dep_check], dependencies: [dep_libevdev, dep_check],
install: false) install: false)
test('test-uinput', test_uinput, suite: 'library') test('test-uinput', test_uinput, suite: ['library', 'needs-uinput'])
test_libevdev = executable('test-libevdev', test_libevdev = executable('test-libevdev',
sources: src_common + [ sources: src_common + [
@ -187,7 +194,7 @@ if dep_check.found()
include_directories: [includes_include], include_directories: [includes_include],
dependencies: [dep_libevdev, dep_check], dependencies: [dep_libevdev, dep_check],
install: false) install: false)
test('test-libevdev', test_libevdev, suite: 'library') test('test-libevdev', test_libevdev, suite: ['library', 'needs-uinput'], env: ['CK_DEFAULT_TIMEOUT=10'])
test_kernel = executable('test-kernel', test_kernel = executable('test-kernel',
sources: src_common + [ sources: src_common + [
@ -196,7 +203,7 @@ if dep_check.found()
include_directories: [includes_include], include_directories: [includes_include],
dependencies: [dep_libevdev, dep_check], dependencies: [dep_libevdev, dep_check],
install: false) install: false)
test('test-kernel', test_kernel, suite: 'kernel') test('test-kernel', test_kernel, suite: ['kernel', 'needs-uinput'])
valgrind = find_program('valgrind', required: false) valgrind = find_program('valgrind', required: false)
@ -205,14 +212,14 @@ if dep_check.found()
valgrind_env.set('CK_TIMEOUT_MULTIPLIER', '10') valgrind_env.set('CK_TIMEOUT_MULTIPLIER', '10')
valgrind_env.set('CK_FORK', 'no') valgrind_env.set('CK_FORK', 'no')
valgrind_env.set('RUNNING_ON_VALGRIND', '1') valgrind_env.set('RUNNING_ON_VALGRIND', '1')
valgrind_suppressions_file = join_paths(dir_src_test, 'valgrind.suppressions') valgrind_suppressions_file = dir_src_test / 'valgrind.suppressions'
add_test_setup('valgrind', add_test_setup('valgrind',
exe_wrapper: [ valgrind, exe_wrapper: [ valgrind,
'--leak-check=full', '--leak-check=full',
'--gen-suppressions=all', '--gen-suppressions=all',
'--error-exitcode=3', '--error-exitcode=3',
'--suppressions=' + valgrind_suppressions_file ], '--suppressions=' + valgrind_suppressions_file ],
env: valgrind_env, env: valgrind_env,
timeout_multiplier: 100) timeout_multiplier: 100)
else else
message('valgrind not found, disabling valgrind test suite') message('valgrind not found, disabling valgrind test suite')
@ -226,12 +233,10 @@ endif
doxygen = find_program('doxygen', required: get_option('documentation')) doxygen = find_program('doxygen', required: get_option('documentation'))
if doxygen.found() if doxygen.found()
doxygen = find_program('doxygen')
src_doxygen = files( src_doxygen = files(
# source files # source files
join_paths(dir_src, 'libevdev.h'), dir_src / 'libevdev.h',
join_paths(dir_src, 'libevdev-uinput.h'), dir_src / 'libevdev-uinput.h',
# style files # style files
'doc/style/bootstrap.css', 'doc/style/bootstrap.css',
'doc/style/customdoxygen.css', 'doc/style/customdoxygen.css',
@ -257,8 +262,8 @@ if doxygen.found()
doc_config.set('PACKAGE_NAME', meson.project_name()) doc_config.set('PACKAGE_NAME', meson.project_name())
doc_config.set('PACKAGE_VERSION', meson.project_version()) doc_config.set('PACKAGE_VERSION', meson.project_version())
doc_config.set('builddir', meson.current_build_dir()) doc_config.set('builddir', meson.current_build_dir())
doc_config.set('top_srcdir', meson.source_root()) doc_config.set('top_srcdir', dir_root)
doc_config.set('srcdir', join_paths(meson.source_root(), 'doc')) doc_config.set('srcdir', dir_root / 'doc')
doxyfile = configure_file(input: 'doc/libevdev.doxygen.in', doxyfile = configure_file(input: 'doc/libevdev.doxygen.in',
output: 'libevdev.doxygen', output: 'libevdev.doxygen',

View file

@ -2,11 +2,15 @@ option('tests',
type: 'feature', type: 'feature',
value: 'enabled', value: 'enabled',
description: 'Build the tests') description: 'Build the tests')
option('tools',
type: 'feature',
value: 'enabled',
description: 'Build the tools')
option('documentation', option('documentation',
type: 'feature', type: 'feature',
value: 'enabled', value: 'enabled',
description: 'Build the documentation') description: 'Build the documentation')
option('coverity', option('coverity',
type: 'boolean', type: 'boolean',
value: 'false', value: false,
description: 'Enable coverity build fixes, see meson.build for details') description: 'Enable coverity build fixes, see meson.build for details')

View file

@ -89,24 +89,11 @@ test_kernel_SOURCES = \
test_kernel_CFLAGS = -I$(top_srcdir) test_kernel_CFLAGS = -I$(top_srcdir)
test_kernel_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la test_kernel_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
if HAVE_VALGRIND
VALGRIND_FLAGS=--leak-check=full \
--quiet \
--error-exitcode=3 \
--suppressions=$(srcdir)/valgrind.suppressions
valgrind:
$(MAKE) check-TESTS CK_TIMEOUT_MULTIPLIER=10 LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)"
check_local_deps += valgrind
endif
if GCOV_ENABLED if GCOV_ENABLED
CLEANFILES = gcov-reports/*.gcov gcov-reports/summary.txt *.gcno *.gcda CLEANFILES = gcov-reports/*.gcov gcov-reports/summary.txt *.gcno *.gcda
gcov-report: generate-gcov-report.sh check-TESTS gcov-report: generate-gcov-report.sh
$(AM_V_GEN)$(srcdir)/generate-gcov-report.sh gcov-reports $(top_builddir)/libevdev $(builddir) $(AM_V_GEN)$(srcdir)/generate-gcov-report.sh gcov-reports $(top_builddir)/libevdev $(builddir)
gcov: gcov-report gcov: gcov-report

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2019 Red Hat, Inc. * Copyright © 2019 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 David Herrmann <dh.herrmann@gmail.com> * Copyright © 2013 David Herrmann <dh.herrmann@gmail.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"
@ -175,7 +158,7 @@ START_TEST(test_code_sw_name)
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_RFKILL_ALL), "SW_RFKILL_ALL"); ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_RFKILL_ALL), "SW_RFKILL_ALL");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_LINEIN_INSERT), "SW_LINEIN_INSERT"); ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_LINEIN_INSERT), "SW_LINEIN_INSERT");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_PEN_INSERTED), "SW_PEN_INSERTED"); ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_PEN_INSERTED), "SW_PEN_INSERTED");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_MAX), "SW_MACHINE_COVER"); ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_MAX), "SW_USB_INSERT");
} }
END_TEST END_TEST

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2014 Red Hat, Inc. * Copyright © 2014 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"
@ -634,12 +617,12 @@ START_TEST(test_syn_delta_sw)
EV_SYN, SYN_DROPPED, EV_SYN, SYN_DROPPED,
EV_SW, SW_HEADPHONE_INSERT, EV_SW, SW_HEADPHONE_INSERT,
EV_SW, SW_MICROPHONE_INSERT, EV_SW, SW_MICROPHONE_INSERT,
EV_SW, SW_MAX, EV_SW, SW_MACHINE_COVER, /* Replace with SW_MAX once runners are on 6.16 */
-1); -1);
uinput_device_event(uidev, EV_SW, SW_HEADPHONE_INSERT, 1); uinput_device_event(uidev, EV_SW, SW_HEADPHONE_INSERT, 1);
uinput_device_event(uidev, EV_SW, SW_MICROPHONE_INSERT, 1); uinput_device_event(uidev, EV_SW, SW_MICROPHONE_INSERT, 1);
uinput_device_event(uidev, EV_SW, SW_MAX, 1); uinput_device_event(uidev, EV_SW, SW_MACHINE_COVER, 1);
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0); uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev); rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC); ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
@ -652,7 +635,7 @@ START_TEST(test_syn_delta_sw)
assert_event(&ev, EV_SW, SW_MICROPHONE_INSERT, 1); assert_event(&ev, EV_SW, SW_MICROPHONE_INSERT, 1);
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev); rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC); ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
assert_event(&ev, EV_SW, SW_MAX, 1); assert_event(&ev, EV_SW, SW_MACHINE_COVER, 1);
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev); rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC); ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
assert_event(&ev, EV_SYN, SYN_REPORT, 0); assert_event(&ev, EV_SYN, SYN_REPORT, 0);
@ -661,7 +644,7 @@ START_TEST(test_syn_delta_sw)
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_HEADPHONE_INSERT), 1); ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_HEADPHONE_INSERT), 1);
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MICROPHONE_INSERT), 1); ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MICROPHONE_INSERT), 1);
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MAX), 1); ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MACHINE_COVER), 1);
uinput_device_free(uidev); uinput_device_free(uidev);
libevdev_free(dev); libevdev_free(dev);
@ -1025,6 +1008,206 @@ START_TEST(test_syn_delta_tracking_ids_btntool)
} }
END_TEST END_TEST
START_TEST(test_syn_delta_mt_tool_type)
{
struct uinput_device* uidev;
struct libevdev *dev;
int rc;
struct input_event ev;
int i;
const int num_slots = 15;
int slot = -1;
unsigned long terminated[NLONGS(num_slots)];
struct input_absinfo abs[7] = {
{ .value = ABS_X, .maximum = 1000 },
{ .value = ABS_Y, .maximum = 1000 },
{ .value = ABS_MT_POSITION_X, .maximum = 1000 },
{ .value = ABS_MT_POSITION_Y, .maximum = 1000 },
{ .value = ABS_MT_TOOL_TYPE, .maximum = MT_TOOL_PALM },
{ .value = ABS_MT_SLOT, .maximum = num_slots },
{ .value = ABS_MT_TRACKING_ID, .minimum = -1, .maximum = 0xff },
};
test_create_abs_device(&uidev, &dev,
ARRAY_LENGTH(abs), abs,
EV_SYN, SYN_REPORT,
-1);
for (i = num_slots; i >= 0; i--) {
int tool_type = MT_TOOL_FINGER;
switch (i) {
case 0:
case 1:
case 2:
case 3:
tool_type = MT_TOOL_FINGER;
break;
case 4:
case 5:
case 6:
case 7:
tool_type = MT_TOOL_PALM;
break;
}
uinput_device_event_multiple(uidev,
EV_ABS, ABS_MT_SLOT, i,
EV_ABS, ABS_MT_TRACKING_ID, i,
EV_ABS, ABS_X, 100 + i,
EV_ABS, ABS_Y, 500 + i,
EV_ABS, ABS_MT_POSITION_X, 100 + i,
EV_ABS, ABS_MT_POSITION_Y, 500 + i,
EV_ABS, ABS_MT_TOOL_TYPE, tool_type,
EV_SYN, SYN_REPORT, 0,
-1, -1);
do {
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
ck_assert_int_ne(rc, LIBEVDEV_READ_STATUS_SYNC);
} while (rc >= 0);
}
/* we have a bunch of touches now, and libevdev knows it. Change all
* touches */
for (i = num_slots; i >= 0; i--) {
uinput_device_event(uidev, EV_ABS, ABS_MT_SLOT, i);
switch (i) {
/* Slot 0 is a finger and stays a finger */
case 0:
/* Slot 4 is a palm and stays a palm */
case 4:
uinput_device_event_multiple(uidev,
EV_ABS, ABS_X, 200 + i,
EV_ABS, ABS_Y, 700 + i,
EV_ABS, ABS_MT_POSITION_X, 200 + i,
EV_ABS, ABS_MT_POSITION_Y, 700 + i,
-1, -1);
break;
/* Slot 1 is a finger and changes active touch to palm */
case 1:
uinput_device_event(uidev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM);
break;
/* Slot 2 is a finger and terminates */
case 2:
/* Slot 6 is a palm and terminates */
case 6:
uinput_device_event(uidev, EV_ABS, ABS_MT_TRACKING_ID, -1);
break;
/* Slot 3 is a finger and restarts as finger */
case 3:
/* Slot 5 is a palm and restarts as finger */
case 5:
uinput_device_event_multiple(uidev,
EV_ABS, ABS_MT_TRACKING_ID, num_slots + i,
EV_ABS, ABS_X, 200 + i,
EV_ABS, ABS_Y, 700 + i,
EV_ABS, ABS_MT_POSITION_X, 200 + i,
EV_ABS, ABS_MT_POSITION_Y, 700 + i,
EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER,
-1, -1);
break;
/* Slot 7 is a palm and restarts and terminates again as finger */
case 7:
uinput_device_event(uidev, EV_ABS, ABS_MT_TRACKING_ID, -1);
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
uinput_device_event_multiple(uidev,
EV_ABS, ABS_MT_TRACKING_ID, num_slots + i,
EV_ABS, ABS_X, 200 + i,
EV_ABS, ABS_Y, 700 + i,
EV_ABS, ABS_MT_POSITION_X, 200 + i,
EV_ABS, ABS_MT_POSITION_Y, 700 + i,
EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER,
-1, -1);
uinput_device_event(uidev, EV_ABS, ABS_MT_TRACKING_ID, -1);
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
break;
}
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
}
/* Force sync */
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
/* now check for the right tracking IDs */
memset(terminated, 0, sizeof(terminated));
slot = -1;
while ((rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev)) != -EAGAIN) {
if (libevdev_event_is_code(&ev, EV_SYN, SYN_REPORT))
continue;
if (libevdev_event_is_code(&ev, EV_ABS, ABS_MT_SLOT)) {
slot = ev.value;
continue;
}
if (libevdev_event_is_code(&ev, EV_ABS, ABS_X) ||
libevdev_event_is_code(&ev, EV_ABS, ABS_Y))
continue;
ck_assert_int_ne(slot, -1);
if (libevdev_event_is_code(&ev, EV_ABS, ABS_MT_TRACKING_ID)) {
switch (slot) {
case 0:
case 1:
case 4:
ck_abort_msg("No ABS_MT_TRACKING_ID expected for this slot");
break;
case 2:
case 6:
case 7:
ck_assert_int_eq(ev.value, -1);
break;
case 3:
case 5:
if (!bit_is_set(terminated, slot)) {
ck_assert_int_eq(ev.value, -1);
set_bit(terminated, slot);
} else {
ck_assert_int_eq(ev.value, num_slots + slot);
}
break;
}
continue;
}
if (libevdev_event_is_code(&ev, EV_ABS, ABS_MT_TOOL_TYPE)) {
switch (slot) {
case 0:
case 2:
case 3:
case 4:
case 6:
ck_abort_msg("No ABS_MT_TOOL_TYPE expected for this slot");
break;
case 1:
ck_assert_int_eq(ev.value, MT_TOOL_PALM);
break;
case 5:
case 7:
ck_assert_int_eq(ev.value, MT_TOOL_FINGER);
break;
}
continue;
}
switch(ev.code) {
case ABS_MT_POSITION_X:
ck_assert_int_eq(ev.value, 200 + slot);
break;
case ABS_MT_POSITION_Y:
ck_assert_int_eq(ev.value, 700 + slot);
break;
default:
ck_abort();
}
}
uinput_device_free(uidev);
libevdev_free(dev);
}
END_TEST
START_TEST(test_syn_delta_late_sync) START_TEST(test_syn_delta_late_sync)
{ {
struct uinput_device* uidev; struct uinput_device* uidev;
@ -2077,6 +2260,7 @@ TEST_SUITE_ROOT_PRIVILEGES(libevdev_events)
add_test(s, test_syn_delta_late_sync); add_test(s, test_syn_delta_late_sync);
add_test(s, test_syn_delta_tracking_ids); add_test(s, test_syn_delta_tracking_ids);
add_test(s, test_syn_delta_tracking_ids_btntool); add_test(s, test_syn_delta_tracking_ids_btntool);
add_test(s, test_syn_delta_mt_tool_type);
add_test(s, test_skipped_sync); add_test(s, test_skipped_sync);
add_test(s, test_incomplete_sync); add_test(s, test_incomplete_sync);

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"
@ -133,10 +116,11 @@ START_TEST(test_event_codes)
test_create_abs_device(&uidev, &dev, test_create_abs_device(&uidev, &dev,
1, &abs, 1, &abs,
-1); -1);
} else } else {
test_create_device(&uidev, &dev, test_create_device(&uidev, &dev,
*evbit, code, *evbit, code,
-1); -1);
}
ck_assert_msg(libevdev_has_event_type(dev, *evbit), "for event type %d\n", *evbit); ck_assert_msg(libevdev_has_event_type(dev, *evbit), "for event type %d\n", *evbit);
ck_assert_msg(libevdev_has_event_code(dev, *evbit, code), "for type %d code %d", *evbit, code); ck_assert_msg(libevdev_has_event_code(dev, *evbit, code), "for type %d code %d", *evbit, code);

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"
@ -125,7 +108,7 @@ int main(void)
srunner_add_suite(sr, t->setup()); srunner_add_suite(sr, t->setup());
} }
srunner_run_all(sr, CK_NORMAL); srunner_run_all(sr, CK_ENV);
failed = srunner_ntests_failed(sr); failed = srunner_ntests_failed(sr);
srunner_free(sr); srunner_free(sr);

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,4 +1,4 @@
noinst_PROGRAMS = libevdev-events noinst_PROGRAMS = libevdev-events libevdev-list-codes
bin_PROGRAMS = \ bin_PROGRAMS = \
touchpad-edge-detector \ touchpad-edge-detector \
mouse-dpi-tool \ mouse-dpi-tool \
@ -10,6 +10,9 @@ libevdev_ldadd = $(top_builddir)/libevdev/libevdev.la
libevdev_events_SOURCES = libevdev-events.c libevdev_events_SOURCES = libevdev-events.c
libevdev_events_LDADD = $(libevdev_ldadd) libevdev_events_LDADD = $(libevdev_ldadd)
libevdev_list_codes_SOURCES = libevdev-list-codes.c
libevdev_list_codes_LDADD = $(libevdev_ldadd)
touchpad_edge_detector_SOURCES = touchpad-edge-detector.c touchpad_edge_detector_SOURCES = touchpad-edge-detector.c
touchpad_edge_detector_LDADD = $(libevdev_ldadd) touchpad_edge_detector_LDADD = $(libevdev_ldadd)
@ -21,5 +24,6 @@ libevdev_tweak_device_LDADD = $(libevdev_ldadd)
dist_man_MANS = \ dist_man_MANS = \
libevdev-tweak-device.1 \ libevdev-tweak-device.1 \
mouse-dpi-tool.1 \
touchpad-edge-detector.1 \ touchpad-edge-detector.1 \
$(NULL) $(NULL)

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2013 Red Hat, Inc. * Copyright © 2013 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -0,0 +1,47 @@
// SPDX-License-Identifier: MIT
/*
* Copyright © 2021 Red Hat, Inc.
*/
/* Lists all event types and codes currently known by libevdev. */
#include "config.h"
#include <stdio.h>
#include <linux/input.h>
#include "libevdev/libevdev.h"
static void
list_event_codes(unsigned int type, unsigned int max)
{
const char *typestr = libevdev_event_type_get_name(type);
if (!typestr)
return;
printf("- %s:\n", typestr);
for (unsigned int code = 0; code <= max; code++) {
const char *str = libevdev_event_code_get_name(type, code);
if (!str)
continue;
printf(" %d: %s\n", code, str);
}
}
int
main (int argc, char **argv)
{
printf("codes:\n");
for (unsigned int type = 0; type <= EV_MAX; type++) {
int max = libevdev_event_type_get_max(type);
if (max == -1)
continue;
list_event_codes(type, (unsigned int)max);
}
return 0;
}

View file

@ -1,23 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2014 Red Hat, Inc. * Copyright © 2014 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

18
tools/mouse-dpi-tool.1 Normal file
View file

@ -0,0 +1,18 @@
.TH MOUSE-DPI-TOOL "1"
.SH NAME
mouse-dpi-tool \- mouse resolution estimation tool
.SH SYNOPSIS
.BR mouse-dpi-tool " <\fIevdev device\fP>"
.SH DESCRIPTION
.B mouse-dpi-tool
reads relative events (mouse movement events) and calculates the
distance covered and maximum frequency of the incoming events.
Combined with a measurement of the actual distance physically covered,
this allows the mouse's resolution to be estimated.
.PP
Some mouse devices provide dynamic frequencies, it is
recommended to measure multiple times to obtain the highest value.
.PP
.SH OPTIONS
.B mouse-dpi-tool
accepts no options.

View file

@ -1,24 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2014 Red Hat, Inc. * Copyright © 2014 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"

View file

@ -2,6 +2,36 @@
set -e set -e
make tag="$1"
rsync --delete -avz doc/html/ freedesktop.org:/srv/www.freedesktop.org/www/software/libevdev/doc/latest case $tag in
-h|--help)
echo "Usage: $0 <tag>"
echo "Builds the libevdev documentation and rsyncs it to the freedesktop.org server."
echo ""
echo "Options:"
echo " tag ... the tag to build (default: master)"
exit 0
;;
1*)
# Helper so we can run it with the numerical tag only, tags
# are all prefixed with libevdev
tag="libevdev-$tag"
;;
**)
;;
esac
tag=${tag:-master}
dir=$(mktemp -d --tmpdir='' libevdev-doc.XXX)
git clone --depth 1 --branch "$tag" https://gitlab.freedesktop.org/libevdev/libevdev.git "$dir"
pushd $dir
builddir=_doc_build
rm -rf "$builddir"
meson setup "$builddir"
ninja -C "$builddir"
# Strip libevdev- prefix from the tag and replace master with latest, whichever applies
htmldir=${tag/#libevdev-/}
htmldir=${htmldir/master/latest}
rsync --delete -avz "$builddir/html/" freedesktop.org:/srv/www.freedesktop.org/www/software/libevdev/doc/${htmldir}
popd

View file

@ -1,24 +1,6 @@
// SPDX-License-Identifier: MIT
/* /*
* Copyright © 2014 Red Hat, Inc. * Copyright © 2014 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "config.h" #include "config.h"