summaryrefslogtreecommitdiff
path: root/libevdev
Commit message (Collapse)AuthorAgeFilesLines
* doc: update the ioctl list with missing ioctlsPeter Hutterer2023-05-081-0/+8
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: remove duplicate doc entry for EVIOCSKEYCODEPeter Hutterer2023-05-081-4/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Include all include files in dist tarballsAlyssa Ross2023-01-131-1/+1
| | | | | | | | | | | | 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>
* Correct documentZixian Liu2022-08-161-1/+1
|
* uinput: use named initializers for the event structPeter Hutterer2022-07-111-1/+7
| | | | | | | | | | 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>
* Fix a few whitespace/coding style issuesPeter Hutterer2022-07-111-1/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix a compiler warningPeter Hutterer2022-07-111-1/+2
| | | | | | | | | | | | [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>
* doc: fix initialization and setup errorJosé Expósito2021-09-041-1/+1
| | | | | | Remove an unnecessary and unmatched curly bracket from the demo code. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* doc: fix uinput device creation warningsJosé Expósito2021-09-041-3/+2
| | | | | | | | | | | | | | | | | 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>
* doc: fix typosUlrich Ölmann2021-08-171-5/+5
| | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
* doc: fix uinput example codeUlrich Ölmann2021-08-171-1/+1
| | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
* make-event-names: Fix determinism issueRichard Purdie2021-02-221-3/+3
| | | | | | | | | | | 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>
* Change to the (always intended) MIT licensePeter Hutterer2021-01-259-161/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* doc: fix conflicting documentation for libevdev_get_event_value()Peter Hutterer2021-01-081-2/+1
| | | | | | | | | | | 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>
* Add libevdev_disable_propertyScott Jann2020-10-193-0/+27
| | | | | | | On some devices, a kernel input property has been set in error and we need the ability to disable that property. Signed-off-by: Scott Jann <sjann@knight-rider.org>
* Add link to Rust bindingsNayan Deshmukh2020-10-101-0/+1
| | | | Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
* doc: fix doxyen complaints after fd6c9b8ca0ec0791cPeter Hutterer2020-09-111-5/+5
| | | | | | Fixes fd6c9b8ca0ec0791c9aca11314bcb39f9c08555b Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* [clang-tidy] do not use else after returnRosen Penev2020-08-272-35/+48
| | | | | | Found with readability-else-after-return Signed-off-by: Rosen Penev <rosenp@gmail.com>
* libevdev: sort includes alphabeticallyRosen Penev2020-08-273-13/+15
| | | | | | Found with clang-tidy's llvm-include-order Signed-off-by: Rosen Penev <rosenp@gmail.com>
* libevdev: fix inconsistent declarationsRosen Penev2020-08-271-5/+5
| | | | | | Found with clang-tidy's readability-inconsistent-declaration-parameter-name Signed-off-by: Rosen Penev <rosenp@gmail.com>
* Document FreeBSD quirksNiclas Zeising2020-08-141-0/+11
| | | | | | Document FreeBSD quirks related to syspath. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* uinput: Implement FreeBSD fetch_syspath_and_devnode()Niclas Zeising2020-08-141-0/+30
| | | | | | | | | | | | Implement a FreeBSD version of fetch_syspath_and_devnode(). FreeBSD does not have sysfs, so instead fetch the device node directly as as this matches with what is returned by the UI_GET_SYSNAME ioctl(). Since there is no sysfs, libevdev_uinput.syspath will always be set to NULL. If the ioctl fail, return -1 from fetch_syspath_and_devnode(), since there is no other way to figure out the device node path. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* uinput: Move SYS_INPUT_DIR to where it is usedNiclas Zeising2020-08-141-2/+2
| | | | | | | | Move the definition of SYS_INPUT_DIR to where it is used, instead of at the top of the file, to make it easier to find. Undefine it at the end of usage to avoid accidental uses. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* Add FreeBSD compatible input.h and uinput.hNiclas Zeising2020-08-141-3/+5
| | | | | | | | | | | | | | | | | Add FreeBSD compatible input.h and uinput.h files. This is done by moving the linux files to include/linux/linux, adding the freebsd versions in include/linux/freebsd, and then changing include/linux/[u]input.h to pull in the right one depending on which OS we are compiling on. Make sure that the build infrastructure in meson.build and autoconf.ac/Makefile.am uses the correct files when building and as dependency for targets, and ensure that make-event-names.py get the correct files as arguments. A similar change has been done in libinput in 61f3e3854458c556a01fb05d7abb22733fd2b7c1 Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* libevdev: any value less than 0 has a NULL namePeter Hutterer2020-07-151-1/+1
| | | | | | Fixes https://gitlab.freedesktop.org/libevdev/libevdev/-/issues/15 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add link to Haskell bindingsGeorge Thomas2020-06-021-0/+1
| | | | Signed-off-by: George Thomas <georgefsthomas@gmail.com>
* Match if/else blocks for curly bracesPeter Hutterer2020-05-262-16/+27
| | | | | | Where either block has braces, the other half should too. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't overrun the changes array when synching > MAX_SLOTSPeter Hutterer2020-03-131-2/+6
| | | | | | | | | | | | | On a device with more than 256 slots we would read (and copy) past our changes stack-allocated changes array. Fix this by capping to MAX_SLOTS though this also requires us to memset the target where it is larger than MAX_SLOTS. There are no real devices with 256+ slots, so this is a theoretical issue only. Fixes #11 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use editorconfig instead of a sprinkling of :vim: instructionsPeter Hutterer2020-02-271-1/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix (theoretical) use of uninitialized variablePeter Hutterer2020-02-191-1/+1
| | | | | | | This cannot ever be unset on any real device, but coverity is unhappy and that's not making me happy. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't try to send BTN_TOOL events for zero fingersPeter Hutterer2020-02-191-2/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Ignore slot sync for slots > 256Peter Hutterer2020-02-191-6/+5
| | | | | | | | | Clang doesn't support variable length arrays inside a struct so we could either make our life complicated or just assume no-one is using more than 256 slots and hard-code that. Let's go for the easy solution until someone notices. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Update the BTN_TOOL bits correctly during SYN_DROPPED handlingPeter Hutterer2020-02-191-3/+51
| | | | | | | | | | | | | | Where at least one touch ends during SYN_DROPPED, we send out two event frames: one with all applicable touch sequences ending (tracking id -1) and the second one with the whole device state *and* the applicable touch sequences starting (tracking id != -1). This requires us to also update the BTN_TOOL_ bits correctly so that they are correct after the first frame. For that we count the number of previously known touches and send a 0 event for the matching BTN_TOOL_ bit, together with a 1 event for the currently known touches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Terminate all stopped/changed touches during SYN_DROPPED in the first framePeter Hutterer2020-02-191-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous event processing had subtle issues with touches stopping during SYN_DROPPED. All of the device state was processed in the same frame, but if any touch changed tracking ID during SYN_DROPPED, an inserted SYN_REPORT resulted in a weird split of events: - the first frame had all key/sw/abs updates including those slots that changed tracking ID, but not the ones that were fully terminated. - the second frame had only the slots states for newly started touches **and** the slot state for touches terminated during SYN_DROPPED but not restarted. In other words, where three fingers were on the touchpad and slot 0 was lifted and put down again and slot 1 was lifted but *not* put down again, our frames contained: - frame 1: terminate slot 0, BTN_TOOL_TRIPLETAP 0, BTN_TOOL_DOUBLETAP 1 - frame 2: start slot 0, terminate slot 1 Where there was no touch changing tracking ID, only one frame was generated. The BTN_TOOL updates were buggy, they may not match the number of fingers down as seen on a frame-by-frame basis. This triggered libinput bug https://gitlab.freedesktop.org/libinput/libinput/issues/422 This patch changes the above example to - frame 1: terminate slot 0, terminate slot 1 - frame 2: start slot 0, BTN_TOOL_TRIPLETAP 0, BTN_TOOL_DOUBLETAP 1 Notably, the first frame no longer contains the BTN_TOOL bits. This patch is one of two, the BTN_TOOL sync bits are part of a follow-up patch. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Invert an if conditionPeter Hutterer2020-02-191-7/+6
| | | | | | | | | | | | | | | | | Go from: if (a != b) continue; foo; to: if (a == b) { foo; } Basically just an indentation change after the condition inversion, makes the follow-up patch easier to review. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Push terminating the slots into a helper functionPeter Hutterer2020-02-191-9/+19
| | | | | | No functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Split the MT state syncing and event generation into two functionsPeter Hutterer2020-02-191-23/+40
| | | | | | | | | | | | In the near future, we will need to handle slot termination *before* any other state synchronization. So let's start splitting things up. This is functionally equivalent though dropping the need_tracking_id_changes variable means we run through all slots now to check if we need to terminate one of them. Given the normal number of slots on a device and that this should only ever run very rarely anyway... meh. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Expand the touch state handling during SYN_DROPPEDPeter Hutterer2020-02-191-16/+39
| | | | | | | | Keep a better state of each touch before/after the SYN_DROPPED. Most of this is currently unused, it's functionally the same as before but the new code serves to increase readability and it can be passed around easier this way. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Make the code for handling before/after SYN_DROPPED slot values more readablePeter Hutterer2020-02-191-4/+6
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Compress an if statementPeter Hutterer2020-02-161-4/+2
| | | | | | No functional changes, just making the code slightly more compressed Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Localize two variablesPeter Hutterer2020-02-161-6/+5
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Uncomplicate the setting of axis during slot syncPeter Hutterer2020-02-161-9/+5
| | | | | | A few bytes get wasted, but no magic handling of offsets etc are required. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Push the tracking id change bits on the stackPeter Hutterer2020-02-162-22/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Push the slot_update bits on the stackPeter Hutterer2020-02-162-14/+4
| | | | | | Much simpler code this way Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Drop the mt_sync_state in our device structPeter Hutterer2020-02-162-25/+13
| | | | | | | | | | Replace it with a stack-allocated one. This saves us a bunch of confusing allocations and size calculations. And in the process use uint32_t/int32_t to ensure the struct is actually the expected size. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* flake8 fixes for make-event-names.pyPeter Hutterer2020-02-141-165/+178
| | | | | | | Mostly whitespace changes, two semicolon removals and one change to "foo is None". Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Change the python script to generate event names to Python3Peter Hutterer2020-02-141-2/+1
| | | | | | It's well past time. If you need this to run on python2, patch it out locally. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* uinput: drop an unused function argumentPeter Hutterer2020-02-141-3/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* config.h is a local include pathPeter Hutterer2020-02-145-5/+5
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add queue_push_event as shortcut for the two-liner we use everywherePeter Hutterer2020-02-122-43/+38
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>