Add support for ISDv4 0x12C tablet

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
ISDv4 touch query timeout should be non-fatal

Both the wacom_w8001 and isdv4.c drivers assume that a tablet /may/
respond to the touchquery packet with silence. This assumption does
not carry over to tools-shared.c, and may cause pen-only tablet PC
users trouble with isdv4-serial-inputattach.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Anshul Sirur <vixus0@gmail.com>
Remove unused function parameter

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Change function signature of commonDispatchDevice

Changes commonDispatchDevice to take an InputInfoPtr rather than a
WacomCommonPtr. This is in prepraration for the next patch where
an InputInfoPtr will be required in wcmEvent. To make this happen,
the call to 'findTool' is moved to wcmEvent. This also allows us
to remove the one-off setting of 'priv' only for touch devices.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Support cross-device pointer arbitration

Currently pointer arbitration is taken care of through the use of
a 'wcomPenInProx' variable in the WacomCommonRec. If two devices
share a 'common' variable, the commonDispatchDevice function will
ensure that touches do not move the pointer while the pen is in
proximity.

This patch adds support for cross-device pointer arbitration to
prevent other touches known to the driver from moving the pointer.
This is achieved with the introduction of a 'WACOM_DRIVER' structure
that is shared by all tools. Inside this structure is an 'active'
variable that keeps track of the last tool which was actively
controlling the pointer. When an event from any tool comes in, the
driver will attempt to determine if it should be filtered or not.
In some cases, the new device will be allowed to take control of
the pointer, and become the new active device.

Note that arbitration occurs *after* we store the device state
to pChannel->valid.state. The code in wcmTouchFilter.c assumes
that states are not missing, and can become desynchronized from
reality if (for example) a finger were to go out of prox without
a corresponding state update.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Add new GESTURE_CANCEL_MODE and wcmCancelGesture function

The new GESTURE_CANCEL_MODE is used to short-circuit the gesture
recognition logic until all touches have been removed from the device.
By using the wcmCancelGesture function, any in-progress gesture will
be canceled and cause the driver to ignore further touch input until a
new gesture is started.

This is used by the arbitration logic to ensure that touches which
accumulate in the valid.state list while a pen is in proximity do not
suddenly trigger a gesture at the moment the pen leaves prox.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
conf: Match Hanwang tablets in their own section

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
conf: Add new InputDevice matches based on USB and PnP ID

If the kernel's HID driver is used rather than wacom.ko, its very
possible that the device will not have "Wacom" anywhere in its
device name. To ensure we are able to match Wacom tablets in this
situation, we add matches based on the known USB and PnP IDs.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
WIP: Allow EMR to grab pointer control only when pointer is idle

This patch changes the how pointer access is arbitrated. Before,
any EMR tool would be immediatley granted control over the
pointer, preempting any tool that may have had it beforehand.
This could lead to "fighting" if two EMR tools were used
simultaneously.

Now, the driver allows a tool to maintain control of the pointer
so long as it is actively generating events. If, for instance,
a pen is brought in proximity of one tablet, a second pen
brought into prox of a second tablet will no longer cause
fighting over the pointer. Deciding if a tool is active based on
its last event timestamp rather than proximity allows a pen
to be used even if a puck has been left on another tablet.

*** NOTE ***

There's been back-and-forth on the issue of this kind of cross-
device EMR arbitration on Windows and Mac. For now, we're going
to continue to use existing behavior since nobody has complained.