Commit graph

615 commits

Author SHA1 Message Date
Peter Hutterer
27528b9668 Change libevdev_grab to take an enum
Enum values fo 3 and 4 to avoid callers using true/false values for grabbing
and ungrabbing. If the evdev mute ioctl is merged, we can extend this
without having to worry about breaking callers.

[1] http://lwn.net/Articles/476830/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 15:24:58 +10:00
Peter Hutterer
cfcfa4c159 gitignore: Ignore tarballs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 15:24:58 +10:00
Peter Hutterer
9dee4db9d7 Split libevdev_new() into _new and _new_from_fd()
libevdev_new() can only fail on allocation failures, but with an fd the
failure options are more. Split into a new function that can return an error
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 15:24:58 +10:00
Peter Hutterer
0867f2f10a Free the event queue on cleanup.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 15:24:39 +10:00
Peter Hutterer
8bdd0639a6 Check for allocation failure in libevdev_new()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 15:22:50 +10:00
Peter Hutterer
05ba468a27 Rename ER_SYNC flag to LIBEVDEV_READ_SYNC
ER dated to an earlier version of this library called libevdev_read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-30 14:05:01 +10:00
Peter Hutterer
ee054e9cf9 Add a function to retrieve the current slot
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-30 14:02:27 +10:00
Peter Hutterer
4ae4f24ef7 Update the MT state properly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-30 13:58:45 +10:00
Peter Hutterer
3e22ef86ab If a client doesn't sync when it should, drop all sync events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-30 13:37:44 +10:00
Peter Hutterer
ec093aa398 After a SYN_DROPPED, drop all events in the queue
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>
2013-05-30 13:37:44 +10:00
Peter Hutterer
549f0f0bcd Abstract the event queue away
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>
2013-05-30 13:37:43 +10:00
Peter Hutterer
f3d94ecfd7 Drop the callback interface, replace with libevdev_next_event
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>
2013-05-30 13:37:25 +10:00
Peter Hutterer
e19994c34c Add log func handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-30 13:25:58 +10:00
Peter Hutterer
8034fdd0d7 Fix MT slot index handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-30 13:25:44 +10:00
Peter Hutterer
a3255d3ec7 libevdev is a library to handle evdev devices
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>
2013-05-29 15:33:21 +10:00