platform/upstream/libevdev.git
11 years agotest: add incomplete test for input props
Peter Hutterer [Thu, 27 Jun 2013 00:37:21 +0000 (10:37 +1000)]
test: add incomplete test for input props

Can't set those via uinput, so we're limited to making sure nothing
goes crazy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotests: add two multitouch tests
Peter Hutterer [Thu, 27 Jun 2013 00:29:11 +0000 (10:29 +1000)]
tests: add two multitouch tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: add test case for device grabbing
Peter Hutterer [Thu, 27 Jun 2013 00:23:23 +0000 (10:23 +1000)]
test: add test case for device grabbing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: test some more event max and invalid event type paths
Peter Hutterer [Thu, 27 Jun 2013 00:22:47 +0000 (10:22 +1000)]
test: test some more event max and invalid event type paths

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoInit dev->grabbed as LIBEVDEV_UNGRAB
Peter Hutterer [Thu, 27 Jun 2013 00:21:44 +0000 (10:21 +1000)]
Init dev->grabbed as LIBEVDEV_UNGRAB

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoReplace a few malloc + strcpy with strdup
Peter Hutterer [Wed, 26 Jun 2013 23:45:58 +0000 (09:45 +1000)]
Replace a few malloc + strcpy with strdup

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoRevert "test: Hook up gcov to require the test name"
Peter Hutterer [Wed, 26 Jun 2013 23:40:41 +0000 (09:40 +1000)]
Revert "test: Hook up gcov to require the test name"

This reverts commit c590c70ea467b37e96b2b4cb41d91776519b569d.

11 years agoPull all tests together into one binary
Peter Hutterer [Wed, 26 Jun 2013 23:40:23 +0000 (09:40 +1000)]
Pull all tests together into one binary

Easier to monitor gcov coverage that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: Hook up gcov to require the test name
Peter Hutterer [Wed, 26 Jun 2013 23:24:05 +0000 (09:24 +1000)]
test: Hook up gcov to require the test name

Make check will simply overwrite results of a previous test. Hook up gcov so that the test has to be
explicitly passed to avoid confusion here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDon't return a NULL name, ever.
Peter Hutterer [Wed, 26 Jun 2013 08:13:24 +0000 (18:13 +1000)]
Don't return a NULL name, ever.

Even if the device is not yet initialized (which would be a caller bug, but still)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix distcheck
Peter Hutterer [Wed, 26 Jun 2013 07:31:15 +0000 (17:31 +1000)]
Fix distcheck

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: add more event queue tests
Peter Hutterer [Wed, 26 Jun 2013 06:48:21 +0000 (16:48 +1000)]
test: add more event queue tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDon't crash peeking at a zero-sized queue
Peter Hutterer [Wed, 26 Jun 2013 06:47:43 +0000 (16:47 +1000)]
Don't crash peeking at a zero-sized queue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUpdate gitignore
Peter Hutterer [Sun, 23 Jun 2013 09:49:47 +0000 (19:49 +1000)]
Update gitignore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: fix includes for distcheck
Peter Hutterer [Sat, 22 Jun 2013 10:00:48 +0000 (20:00 +1000)]
test: fix includes for distcheck

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoSlots are now definitely zero-indexed, see recent kernel patch
Peter Hutterer [Sat, 22 Jun 2013 09:45:39 +0000 (19:45 +1000)]
Slots are now definitely zero-indexed, see recent kernel patch

doc: specify that ABS_MT_SLOT must have a minimum of 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDocumentation fixes
Peter Hutterer [Sat, 22 Jun 2013 09:44:03 +0000 (19:44 +1000)]
Documentation fixes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUse doxygen instead of man pages
Peter Hutterer [Sat, 22 Jun 2013 09:13:36 +0000 (19:13 +1000)]
Use doxygen instead of man pages

Doxygen is bad for man pages, but having an online API documentation
is better and easier to maintain.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix stray code tag in html
Peter Hutterer [Tue, 18 Jun 2013 11:57:34 +0000 (21:57 +1000)]
Fix stray code tag in html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agotest: add test for internal event queue
Peter Hutterer [Sun, 9 Jun 2013 10:22:18 +0000 (20:22 +1000)]
test: add test for internal event queue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFix queue_num_free_elements
Peter Hutterer [Sun, 9 Jun 2013 10:11:39 +0000 (20:11 +1000)]
Fix queue_num_free_elements

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>
11 years agoDon't return the next element if the queue is full
Peter Hutterer [Wed, 26 Jun 2013 07:26:50 +0000 (17:26 +1000)]
Don't return the next element if the queue is full

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDon't allow a queue size of 0.
Peter Hutterer [Sun, 9 Jun 2013 10:07:14 +0000 (20:07 +1000)]
Don't allow a queue size of 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUse a size_t, not an int, where appropriate
Peter Hutterer [Sun, 9 Jun 2013 10:03:50 +0000 (20:03 +1000)]
Use a size_t, not an int, where appropriate

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoHook up gcov
Peter Hutterer [Wed, 5 Jun 2013 07:30:08 +0000 (17:30 +1000)]
Hook up gcov

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoDirectly compile libevdev sources
Peter Hutterer [Wed, 5 Jun 2013 06:50:48 +0000 (16:50 +1000)]
Directly compile libevdev sources

This avoids messing around with libtool for debugging. I may revert this
once the library is actually slightly stable, but for now this makes things
easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd a test for event the various libevdev_has_event * functions
Peter Hutterer [Wed, 5 Jun 2013 05:31:00 +0000 (15:31 +1000)]
Add a test for event the various libevdev_has_event * functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAdd an API to get the repeat values
Peter Hutterer [Sun, 9 Jun 2013 09:48:19 +0000 (19:48 +1000)]
Add an API to get the repeat values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoman: add a note about EV_REP values
Peter Hutterer [Sun, 9 Jun 2013 09:49:10 +0000 (19:49 +1000)]
man: add a note about EV_REP values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoHandle EV_REP events in event-names.h
Peter Hutterer [Wed, 5 Jun 2013 06:43:15 +0000 (16:43 +1000)]
Handle EV_REP events in event-names.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>