platform/upstream/libevdev.git
11 years agoAdd the remaining ev bits
Peter Hutterer [Wed, 5 Jun 2013 06:30:00 +0000 (16:30 +1000)]
Add the remaining ev bits

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUse a macro for type_to_mask
Peter Hutterer [Wed, 5 Jun 2013 06:03:54 +0000 (16:03 +1000)]
Use a macro for type_to_mask

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd function to get max value for a given ev type
Peter Hutterer [Wed, 5 Jun 2013 06:01:25 +0000 (16:01 +1000)]
Add function to get max value for a given ev type

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDefault to a max of -1 for undefined EV_foo bits
Peter Hutterer [Wed, 5 Jun 2013 06:00:56 +0000 (16:00 +1000)]
Default to a max of -1 for undefined EV_foo bits

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix type_to_mask to return -1
Peter Hutterer [Wed, 5 Jun 2013 01:22:35 +0000 (11:22 +1000)]
Fix type_to_mask to return -1

EV_SYN doesn't have a max, so 0 is not enough.

returning 0 on failure is a bad idea, as mask is unset.

11 years agotest: add infrastructure for uinput device tests
Peter Hutterer [Wed, 5 Jun 2013 01:17:11 +0000 (11:17 +1000)]
test: add infrastructure for uinput device tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd functions to enable axis on the device in the kernel
Peter Hutterer [Tue, 4 Jun 2013 06:24:11 +0000 (16:24 +1000)]
Add functions to enable axis on the device in the kernel

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoInline the type-to-mask helpers
Peter Hutterer [Tue, 4 Jun 2013 05:55:20 +0000 (15:55 +1000)]
Inline the type-to-mask helpers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoMove utility functions to a separate header
Peter Hutterer [Tue, 4 Jun 2013 05:46:03 +0000 (15:46 +1000)]
Move utility functions to a separate header

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd a few includes the libevdev-int.h needs
Peter Hutterer [Tue, 4 Jun 2013 05:44:51 +0000 (15:44 +1000)]
Add a few includes the libevdev-int.h needs

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>
11 years agoProtect against NULL device on log handler
Peter Hutterer [Tue, 4 Jun 2013 04:53:30 +0000 (14:53 +1000)]
Protect against NULL device on log handler

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoSet up a test harness
Peter Hutterer [Tue, 4 Jun 2013 01:11:57 +0000 (11:11 +1000)]
Set up a test harness

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoBlacklist some key names that resolve to other names
Peter Hutterer [Tue, 4 Jun 2013 01:11:25 +0000 (11:11 +1000)]
Blacklist some key names that resolve to other names

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoSwitch tools to use libevdev_get_event_*_name interface
Peter Hutterer [Tue, 4 Jun 2013 01:15:29 +0000 (11:15 +1000)]
Switch tools to use libevdev_get_event_*_name interface

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoExpose API for retrieving event names
Peter Hutterer [Mon, 3 Jun 2013 23:52:20 +0000 (09:52 +1000)]
Expose API for retrieving event names

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd man page for libevdev_get_event_value and friends
Peter Hutterer [Mon, 3 Jun 2013 23:53:32 +0000 (09:53 +1000)]
Add man page for libevdev_get_event_value and friends

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoMove libevdev-events over to a tools directory
Peter Hutterer [Mon, 3 Jun 2013 23:35:14 +0000 (09:35 +1000)]
Move libevdev-events over to a tools directory

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoMerge libevdev-print and libevdev-events into one binary
Peter Hutterer [Mon, 3 Jun 2013 23:31:46 +0000 (09:31 +1000)]
Merge libevdev-print and libevdev-events into one binary

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: drop unused function print_code_bits
Peter Hutterer [Mon, 3 Jun 2013 23:30:45 +0000 (09:30 +1000)]
test: drop unused function print_code_bits

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDrop requirement on ffi - copy/paste leftover
Peter Hutterer [Tue, 4 Jun 2013 00:12:16 +0000 (10:12 +1000)]
Drop requirement on ffi - copy/paste leftover

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAllow libevdev_free on a NULL pointer.
Peter Hutterer [Tue, 4 Jun 2013 01:15:00 +0000 (11:15 +1000)]
Allow libevdev_free on a NULL pointer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoInclude stdarg for va_list.
Peter Hutterer [Tue, 4 Jun 2013 00:16:36 +0000 (10:16 +1000)]
Include stdarg for va_list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoSkip over ABS_MT_SLOT when syncing MT axis values
Peter Hutterer [Mon, 3 Jun 2013 06:36:34 +0000 (16:36 +1000)]
Skip over ABS_MT_SLOT when syncing MT axis values

The slot event is already on the queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix invalid abs_info read
Peter Hutterer [Mon, 3 Jun 2013 06:36:10 +0000 (16:36 +1000)]
Fix invalid abs_info read

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFill in the last event time for synced events
Peter Hutterer [Mon, 3 Jun 2013 06:20:35 +0000 (16:20 +1000)]
Fill in the last event time for synced events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUpdate README
Peter Hutterer [Mon, 3 Jun 2013 05:24:54 +0000 (15:24 +1000)]
Update README

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoLet the name be dynamically allocated
Peter Hutterer [Mon, 3 Jun 2013 04:20:34 +0000 (14:20 +1000)]
Let the name be dynamically allocated

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoExpose phys/uniq to the caller
Peter Hutterer [Mon, 3 Jun 2013 03:59:06 +0000 (13:59 +1000)]
Expose phys/uniq to the caller

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoExport version fields as well
Peter Hutterer [Mon, 3 Jun 2013 03:35:28 +0000 (13:35 +1000)]
Export version fields as well

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd man-pages for the current interface
Peter Hutterer [Fri, 31 May 2013 01:46:20 +0000 (11:46 +1000)]
Add man-pages for the current interface

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoRename pid/vid to product-id and vendor-id
Peter Hutterer [Mon, 3 Jun 2013 01:22:39 +0000 (11:22 +1000)]
Rename pid/vid to product-id and vendor-id

Slightly more expressive and it's not that painful to type.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd a FIXME for lack of O_NONBLOCK
Peter Hutterer [Fri, 31 May 2013 05:16:57 +0000 (15:16 +1000)]
Add a FIXME for lack of O_NONBLOCK

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd a fixme: if we're dropping sync event, libedev loses state info too
Peter Hutterer [Fri, 31 May 2013 05:01:32 +0000 (15:01 +1000)]
Add a fixme: if we're dropping sync event, libedev loses state info too

If a client doesn't care about syncing that's one thing, but
libevdev functions still need to return the right _current_ (i.e. synced)
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDon't allow re-setting the fd
Peter Hutterer [Fri, 31 May 2013 04:53:42 +0000 (14:53 +1000)]
Don't allow re-setting the fd

If a caller needs to re-init a device, libevdev_new_from_fd() is a better
choice.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoChange libevdev_grab to take an enum
Peter Hutterer [Fri, 31 May 2013 04:48:43 +0000 (14:48 +1000)]
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>
11 years agogitignore: Ignore tarballs
Peter Hutterer [Fri, 31 May 2013 04:48:24 +0000 (14:48 +1000)]
gitignore: Ignore tarballs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoSplit libevdev_new() into _new and _new_from_fd()
Peter Hutterer [Fri, 31 May 2013 01:26:58 +0000 (11:26 +1000)]
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>
11 years agoFree the event queue on cleanup.
Peter Hutterer [Fri, 31 May 2013 05:24:39 +0000 (15:24 +1000)]
Free the event queue on cleanup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoCheck for allocation failure in libevdev_new()
Peter Hutterer [Fri, 31 May 2013 01:26:01 +0000 (11:26 +1000)]
Check for allocation failure in libevdev_new()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoRename ER_SYNC flag to LIBEVDEV_READ_SYNC
Peter Hutterer [Thu, 30 May 2013 04:04:33 +0000 (14:04 +1000)]
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>
11 years agoAdd a function to retrieve the current slot
Peter Hutterer [Thu, 30 May 2013 04:02:17 +0000 (14:02 +1000)]
Add a function to retrieve the current slot

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUpdate the MT state properly
Peter Hutterer [Thu, 30 May 2013 03:58:45 +0000 (13:58 +1000)]
Update the MT state properly

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoIf a client doesn't sync when it should, drop all sync events
Peter Hutterer [Thu, 30 May 2013 02:24:46 +0000 (12:24 +1000)]
If a client doesn't sync when it should, drop all sync events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAfter a SYN_DROPPED, drop all events in the queue
Peter Hutterer [Thu, 30 May 2013 02:20:21 +0000 (12:20 +1000)]
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>
11 years agoAbstract the event queue away
Peter Hutterer [Thu, 30 May 2013 01:05:24 +0000 (11:05 +1000)]
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>
11 years agoDrop the callback interface, replace with libevdev_next_event
Peter Hutterer [Thu, 30 May 2013 00:42:24 +0000 (10:42 +1000)]
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>
11 years agoAdd log func handling
Peter Hutterer [Wed, 29 May 2013 23:00:13 +0000 (09:00 +1000)]
Add log func handling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix MT slot index handling
Peter Hutterer [Thu, 30 May 2013 02:18:39 +0000 (12:18 +1000)]
Fix MT slot index handling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agolibevdev is a library to handle evdev devices
Peter Hutterer [Mon, 27 May 2013 04:59:41 +0000 (14:59 +1000)]
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>