summaryrefslogtreecommitdiff
path: root/libevdev/libevdev.h
Commit message (Collapse)AuthorAgeFilesLines
* Note that libevdev_free() does not close the fdPeter Hutterer2015-06-291-0/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* cosmetic: fix a couple of duplicate/missing empty linesPeter Hutterer2015-03-041-3/+5
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: add the prefixing * to all @code doxygen sectionsPeter Hutterer2014-11-181-163/+163
| | | | | | | | These were removed in (7da329b) because for some reason they got copied into the output. That was either a buggy doxygen or just some other problem. Add them again, makes it much easier to read the header file. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: fix slightly confusing code/type commentsRan Benita2014-08-281-3/+3
| | | | | Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add some minimal documentation about static linkingPeter Hutterer2014-08-251-0/+14
| | | | | | | I can't recommend it, but I can't stop people from doing it, so at least document the ground rules. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add libevdev_property_from_name()Peter Hutterer2014-08-201-0/+30
| | | | | | | | | 12717d79 "Add libevdev_event_type/code_from_name() resolvers" added the lookup functions for types and codes, this commit adds the missing ones for input properties. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Add per-device log handlersPeter Hutterer2014-06-051-5/+92
| | | | | | | | | | | | | | | | | | | | | | The global log handler isn't a good choice for a low-level library. In the caser of the X server, both evdev and synaptics are now using the libevdev but are loaded from the same server process. Thus, there's only one log handler, but evdev and synaptics don't talk to each other (a bit childish, I know). Add a per-device log handler that overrides the global log handler, and fall back to the global log handler if no device log handler is set. The log macros take care of that automatically, especially as we can't do per-device log handlers for the uinput code. Note that we use the same struct for the global and device logging, so in each instance one of the two function pointers is NULL. Suicide triggers are in place in case we mess that up. This also makes libevdev_new_from_fd() a bit less useful since we can't set the log handler beforehand. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Mark the log functions with the printf format attributePeter Hutterer2014-06-051-1/+4
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Document that we need uinput in the kernel for the test suitePeter Hutterer2014-05-221-1/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Drain all events before synchronizing after SYN_DROPPEDPeter Hutterer2014-04-241-0/+45
| | | | | | | | | | | | | | | | | | | | The kernel ring buffer drops all events on SYN_DROPPED, but then continues to fill up again. So by the time we read the events, the kernel's client buffer is essentially like this: SYN_DROPPED, ev1, ev2, ev3, ...., evN The kernel's device state represents the device after evN, and that is what the ioctls return. For EV_KEY, EV_SND, EV_LED and EV_SW the kernel removes potential duplicates from the client buffer [1], it doesn't do so for EV_ABS. So we can't actually sync while there are events on the wire because the events represent an earlier state. So simply discard all events in the kernel buffer, synchronize, and then start processing again. We lose some granularity but at least the events are correct. [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/input/evdev.c?id=483180281f0ac60d1138710eb21f4b9961901294 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Clarify what signal-safe meansPeter Hutterer2014-04-101-3/+4
| | | | | | Just in case... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Calling libevdev_enable_event_code() overwrites EV_ABS/EV_REP valuesPeter Hutterer2014-04-081-0/+4
| | | | | | Document this behaviour Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Split the SYN_DROPPED page into a few sectionsPeter Hutterer2014-04-071-0/+9
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix a typo, add a @ref in the documentationPeter Hutterer2014-04-071-2/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Drop hardcoded MAX_SLOTS in favour of pre-allocated memoryPeter Hutterer2014-04-031-5/+0
| | | | | | | | | | | | | | | | | | | | | We can't allocate in sync_mt_state since it may be called in the signal handler. So pre-allocate based on the device's number of slots, store that in the libevdev struct and use it for the sync process. This fixes a remaining bug with the handling of ABS_MT_TRACKING_ID. If a device had > MAX_SLOTS and a slot above that limit would start or stop during a SYN_DROPPED event, the slot would not be synced, and a subsequent touch in that slot may double-terminate or double-open a touchpoint in the client. For the effects of that see commit 41334b5b40cd5456f5f584b55d8888aaafa1f26e Author: Peter Hutterer <peter.hutterer@who-t.net> Date: Thu Mar 6 11:54:00 2014 +1000 If the tracking ID changes during SYN_DROPPED, terminate the touch first Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Add documentation for axis updates without a tracking IDPeter Hutterer2014-03-211-0/+49
| | | | | | | | | | | If a touch starts and terminates while in SYN_DROPPED, the tracking ID appears to stay at -1, but the other axes may update. We need to pass these on to the client since the kernel may buffer the next event with the same value otherwise. Note this in the documentation so that client's don't create touch points based on out-of-touchpoint updates. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* add a linebreak for correct rendering of the documentationPeter Hutterer2014-03-181-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: move the section for the internal test suite downPeter Hutterer2014-03-141-46/+46
| | | | | | | | | "Related Pages" in doxygen are ordered in the order they appear in the source file. The internal test suite is least likely to be of interest to the reader, so move it to the bottom. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* doc: include linux/input.h verbatim in the documentationPeter Hutterer2014-03-141-0/+9
| | | | | | | | This makes it easier to look up what specific version libevdev was compiled against. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* doc: Add documentation on how SYN_DROPPED is handledPeter Hutterer2014-03-141-2/+158
| | | | | | | | This is getting a bit complex, so add some high-level documentation that we at least know what we're trying to do. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Add a documentation note to update the slot after syncingPeter Hutterer2014-03-071-1/+5
| | | | | | | | | | Clients may not care about the events generated during SYN_DROPPED, but the current slot must be updated to avoid a client being out-of-date. Same with tracking IDs, if they changed, the caller will likely have to update some internal states. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Don't sync the MT state for fake MT devicesPeter Hutterer2014-03-061-0/+6
| | | | | | | | | | | | | Devices with ABS_MT_SLOT-1 are fake MT devices, they merely overlap the axis range but don't actually provide slots. The EVIOCGABS ioctl won't work to retrieve the current value - the kernel does not store values for those axes and the return value is always 0. Thus, simply ignore those axes for fake MT devices and instead rely on the next event to update the caller with the correct state for each axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Cap slot values to the announced maximumPeter Hutterer2014-03-061-1/+6
| | | | | | | | | | | | | | A malicious device may announce N slots but then send a slot index >= N. The slot state is almost always allocated (definitely the case in libevdev and true for most callers), so providing a slot number higher than the announced maximum is likely to lead to invalid dereferences. Don't allow that. Likewise, don't allow negative slot numbers. Note that the kernel filters these events anyway, the only way to trigger this is to change the device fd to something outside the kernel's control. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Increase MAX_SLOTS to 60Peter Hutterer2014-03-061-1/+1
| | | | | | | | | As seen on 3M devices, which seems to be the maximum seen so far. Some Stantum devices report 255 touches but are only capable of 10, so the are not affected by our limits. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Don't sync past MAX_SLOTS slotsPeter Hutterer2014-03-061-0/+4
| | | | | | | | | | If a device has more than MAX_SLOTS slots, we'd run out-of-bounds on the sync array. This function is sig-safe, so we can't alloc here, merely limit the access. Reported-by: Jonas Ã…dahl <jadahl@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Fix a wrong reference in the libevdev_next_event documentationPeter Hutterer2014-03-061-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Document the FORCE_SYNC behavior a bit betterPeter Hutterer2014-03-051-0/+7
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Document that the return value of get_name|uniq|phys is not permanentPeter Hutterer2014-02-251-0/+24
| | | | | | | It's a pointer to the copy libevdev has, but that copy may be freed by the caller if someone calls e.g. libevdev_set_name() Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use 0 instead of "zero"Peter Hutterer2014-02-121-7/+7
| | | | | | | | We're a bit inconsistent here anyway because of the ample use of "non-zero" which can't really be converted to non-0. But let's at least be consistent with the use of 0 instead of zero. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* More documentation fixes and improvementsPeter Hutterer2014-02-121-24/+52
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Mark a few more functions as signal-safePeter Hutterer2014-02-121-0/+14
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Improve the documentation a bitPeter Hutterer2014-02-111-11/+24
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Document that we don't support EVIOCREVOKEPeter Hutterer2014-02-111-0/+3
| | | | | | | This is intentional, see http://lists.freedesktop.org/archives/input-tools/2014-January/000688.html Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: detect if we're running inside gdb and disable forkingPeter Hutterer2013-12-241-2/+3
| | | | | | | | | The Check test framework forks by default which is annoying when running gdb. Try to detect whether we're inside gdb by ptracing ourselves. If that works, we're not inside a debugger. If it doesn't, then assume we're inside a debugger and set CK_FORK to "no". Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Documentation rewordings and additionsPeter Hutterer2013-12-241-6/+9
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Documentation typo fixesPeter Hutterer2013-12-241-4/+4
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add more cross-referencesPeter Hutterer2013-12-241-9/+9
| | | | | | | doxygen doesn't detect enum cross-references automatically, prefix them with @ref Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: remove initial * from example code linesPeter Hutterer2013-12-241-51/+51
| | | | | | doxygen actually copies that over into the resulting output. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't treat devices with (ABS_MT_SLOT - 1) as multitouch devicesPeter Hutterer2013-12-101-0/+9
| | | | | | | | | | | | | Some devices (PS3 sixaxis controller) merely have a bunch of axes, without the semantic information that linux/input.h requires. For those, the ABS_MT range may be merely another axis, not the special range that we need to treat it with. Use a simple heuristic: if ABS_MT_SLOT - 1 is enabled, don't treat ABS_MT as multitouch axes. The ABS_MT_SLOT - 1 axis is not used for a real axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Merge branch 'ev-rep-handling'Peter Hutterer2013-12-091-3/+7
|\
| * Support EV_REP values through libevdev_get_event_valuePeter Hutterer2013-12-091-2/+6
| | | | | | | | | | | | | | | | | | We shouldn't have a separate API for that, the whole point of libevdev is to abstract the quirkyness of the ioctls into a common interface. So let's export the two EV_REP values through libevdev_get_event_value. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
| * Constify libevdev_get_repeatPeter Hutterer2013-12-091-1/+1
| | | | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* | State that the event is defined for a SYN_DROPPEDPeter Hutterer2013-12-091-3/+5
|/ | | | | | | | | | | | All clients that want to handle SYN_DROPPED correctly need to pass an EV_SYN through their own handlers before starting with the syn events. Rather than letting them synthesize that, guarantee that the event is defined the first time LIBEVDEV_READ_STATUS_SYNC is returned. This does not change existing behavior, it merely documents it so we can rely on it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Move the testing part to a separate pagePeter Hutterer2013-12-091-11/+13
| | | | | | Not something that interests the average visitor of the front page Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add a doxygen page listing the ioctls and their current supportPeter Hutterer2013-12-091-1/+63
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Documentation fix, refer to correct functionPeter Hutterer2013-12-051-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix a typo in the documentationPeter Hutterer2013-12-051-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Drop trailing comma from last element in the enumsPeter Hutterer2013-11-221-6/+5
| | | | | | | If a caller is compiled with -pedantic, this causes a few complaints Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Drop deprecated functionsPeter Hutterer2013-11-221-30/+0
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* Provide separate lookup functions for zero-terminated stringsPeter Hutterer2013-11-011-5/+42
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>