Flip configuration to take key/value pairs.

This is a lot more flexible to deal with while the code moves around a lot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: fix tapping state machine

A bunch of states prematurely ended in IDLE which would result in single-tap
events on e.g. a two-finger hold past the timeout followed by a third finger
tap. Fix the state machine and update the diagram.

There's one final state DEAD which essentially represents a state were we
don't have anything to go on any further and need to be finger-counting until
we're back to IDLE.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: put a warning in to update the diagram in lockstep

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: always handle timeouts

We can't guarantee that the timeouts are sent when we expect them, they may
come after a state-change to a state that doesn't care about timeouts. In that
case, just ignore them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: log bug for events with no fingers down

This is a bug, the state machine is out of sync if we get here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: drop TAP_EVENT_NONE, unused

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: drop default switch cases to get better compiler warnings

Forces us to handle all events in all states.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Put a couple of argument range checks into the code

This is a test trial of something I've wanted for a while to ease debugging
and development. Simple macro that checks arguments for valid ranges at
runtime.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add likely/unlikely macros

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add a mask to note what types of events are pending

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tap: add physical button presses to the tap handling

Any physical button press event terminates current tap handling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools: drop unneeded include

Leftover from an earlier version

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: add ARRAY_FOR_EACH helper macro

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: undef min/max before redefining it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: provide a macro to loop through the touch points

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: add a bunch more debug helper macros

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: move zalloc to touchpad-util.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: include stdlib for calloc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Make a note of the time libtouchpad uses

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add hook to get the underlying libevdev device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>