summaryrefslogtreecommitdiff
path: root/libevdev/libevdev-int.h
Commit message (Collapse)AuthorAgeFilesLines
* Drop hardcoded MAX_SLOTS in favour of pre-allocated memoryPeter Hutterer2014-04-031-1/+14
| | | | | | | | | | | | | | | | | | | | | 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>
* Move some functions/macros between libevdev-int.h and libevdev-util.hPeter Hutterer2014-03-061-16/+56
| | | | | | | | This allows libevdev-util.h to be used by tests, it no longer relies on libevdev internal structs. 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>
* Dynamically allocate the slot valuesPeter Hutterer2014-03-061-1/+1
| | | | | | | | Instead of relying on a static MAX_SLOTS array, allocated it based on the number of slots we have on the device. The previous checks for MAX_SLOTS were incomplete, causing out-of-bound reads. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Allow -1 as valid fd in libevdev_change_fdPeter Hutterer2013-10-141-0/+2
| | | | | | | | | | | Add a new flag for "initialized" and separate that from the fd logic. This way, we can call libevdev_change_fd(dev, -1) to signal that the current fd should be dropped. Otherwise libevdev can't be told to release the fd and always keeps a reference to it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Uppercase #define LIBEVDEV_INT_HPeter Hutterer2013-10-081-2/+2
| | | | | | over-eager search/replace Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Name-space the read flags betterPeter Hutterer2013-09-111-3/+3
| | | | | | | | Rename from LIBEVDEV_READ_foo to LIBEVDEV_READ_FLAG_foo to differentiate better from LIBEVDEV_READ_STATUS_foo. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Revamp the API once againPeter Hutterer2013-09-101-0/+1
| | | | | | | | | | | | | | | | | Another look at the current API showed some inconsistencies, rectified in this commit: libevdev_kernel_*: modify the underlying kernel device libevdev_event_type_*: something with an event type libevdev_event_code_*: something with an event code libevdev_event_*: struct input_event-related functions (i.e. not device-related) libevdev_property_*: something with a property libevdev_*: anything applying to a device Hopefully that's the last API change. Current symbols deprecated and aliased. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Drop per-device logging function, use per-library one insteadPeter Hutterer2013-09-031-2/+25
| | | | | | | | | | | | | | | | There's no need to have separate logging function for each device created. More likely, libevdev will be hooked up once into the logging system and expected to deal with it. Plus, this allows us to log from the uinput code where we don't have the context anyway. Requires a rename to libevdev_set_log_function to avoid ABI breaks, and while we're breaking the ABI make the logging function more sophisticated to log line, number, etc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Use ENOMEM instead of ENOSPCPeter Hutterer2013-08-311-2/+2
| | | | | | | | | | | | From errno(3): ENOMEM Not enough space (POSIX.1) ENOSPC No space left on device (POSIX.1) when we run out memory the reason is a failed malloc, for which ENOMEM seems more appropriate. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Fix two signed vs unsigned int warningsPeter Hutterer2013-08-291-1/+1
| | | | | | | | dev->num_slots is -1 if we don't have ABS_MT_SLOT. Set dev->grabbed to the right field type. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Mark all external symbols with LIBEVDEV_EXPORTPeter Hutterer2013-08-291-0/+1
| | | | | | | | | GCC_CFLAGS was set by configure, but never actually used. So we didn't build with hidden symbols, rather just weeded them out later through libtool. Do this properly now, mark the symbols as visibility default. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Axis values must be int, not unsigned intPeter Hutterer2013-08-291-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add support for EV_SWPeter Hutterer2013-08-291-0/+1
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Keep the LED state and sync it after SYN_DROPPEDPeter Hutterer2013-08-151-0/+1
| | | | | | | | This enables libevdev_get_event_value(dev, EV_LED, LED_NUML); to check if a LED is on or off. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Set the size for repeat delays based on REP_CNTPeter Hutterer2013-07-311-1/+1
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Switch to a state machine to handle incomplete syncsPeter Hutterer2013-07-021-1/+18
| | | | | | | | A caller may start syncing but switch back to normal half-way through the sync. In that case, we need to drop all sync events and continue with regular events only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't crash peeking at a zero-sized queuePeter Hutterer2013-06-271-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix queue_num_free_elementsPeter Hutterer2013-06-271-1/+4
| | | | | | | Return 0 for an unallocated queue, and return the actual number of events (rather than one too little). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't return the next element if the queue is fullPeter Hutterer2013-06-271-0/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Don't allow a queue size of 0.Peter Hutterer2013-06-271-0/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use a size_t, not an int, where appropriatePeter Hutterer2013-06-271-7/+7
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add the remaining ev bitsPeter Hutterer2013-06-261-0/+6
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add a few includes the libevdev-int.h needsPeter Hutterer2013-06-041-0/+3
| | | | | | | These were hidden due to the include order from the .c files, but really, libevdev-int should include them. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fill in the last event time for synced eventsPeter Hutterer2013-06-031-0/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Let the name be dynamically allocatedPeter Hutterer2013-06-031-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Expose phys/uniq to the callerPeter Hutterer2013-06-031-0/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Export version fields as wellPeter Hutterer2013-06-031-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Free the event queue on cleanup.Peter Hutterer2013-05-311-0/+8
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Update the MT state properlyPeter Hutterer2013-05-301-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* After a SYN_DROPPED, drop all events in the queuePeter Hutterer2013-05-301-10/+51
| | | | | | | | Ideally, we could sync by pre-pending all the sync events and then pretend nothing happened but our queue is too small and likely too full for any extra events. So drop all events, then add the sync events to the queue. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Abstract the event queue awayPeter Hutterer2013-05-301-0/+99
| | | | | | | Provide a couple of handler functions to avoid erroneous queue updates. This will make it easier if we need to swap queue implementation later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Drop the callback interface, replace with libevdev_next_eventPeter Hutterer2013-05-301-4/+1
| | | | | | | | | | | Callbacks looked good on paper, but synaptics ran into an issue already that it just couldn't easily pass around the state needed in the actual event processing function. Replace with a new interface that only returns the next event (still reading more off the fd while doing so). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add log func handlingPeter Hutterer2013-05-301-0/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* libevdev is a library to handle evdev devicesPeter Hutterer2013-05-291-0/+66
Two main goals of this library: - 'transparently' handle SYN_DROPPED events - avoid errors in ioctl handling by providing a simpler interface. Keeps a cached copy of the device for quick querying. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>