wacom 0.25.0

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Don't assume tablet (x,y) always starts from (0,0)

Newer Cintiqs have an outbound of 200 tablet count outside of screen
area. This causes absinfo.minimum to be 200 for some tablets instead
of always 0 for all tablets. Update struct _WacomDeviceRec and
_WacomCommonRec to process this change.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Set tool device ID for generic protocol hardware

The code in usbParseKeyEvent which is supposed to set a device
ID ignores the case of devices which use the generic protocol.
This patch changes the logic so that a device ID is assigned
from the BTN_* event for any non-protocol 5 device.

Fixes: https://sourceforge.net/p/linuxwacom/bugs/246/
Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
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>
Remove useless assignment
scan-build: Unix API: Allocator sizeof operand mismatch

Result of 'calloc' is converted to a pointer of type 'unsigned long',
which is incompatible with sizeof operand type 'long'
scan-build: Logic error: Branch condition evaluates to a garbage value

1 (line 88): 'attr_id' declared without an initial value
2 (line 96): ASSUME Loop condition is false. Execution continues on line
107
3 (line 107): Branch condition evaluates to a garbage value
scan-build: Memory Error: Memory leak

strjoinsplit requires the caller to free memory
scan-build: Logic error: Result of operation is garbage or undefined

Assuming nitems is less than we expect, its possible for
get_mapped_area to return before writing values to its in-parameters.
This adds an additional verification to the returned data type.
scan-build: Unix API: Undefined allocation of 0 bytes
scan-build: Logic error: Dereference of null pointer

If no match is found within the 'while' loop, the value of 'ndevices'
will be -1 at the point we reach 'if (!ndevices)' since we use the
post-decrement rather than pre-decrement operator. In addition to
never producing the expected error message, this also results in a
NULL dereference immediately afterwards.
Fix clang warnings about garbage data

The isdv4ParseTouchQuery and isdv4ParseTouchData functions
return 0 and -1 if errors occur. At the moment, only the -1
case is being handled, which can result in the callers using
uninitialized ISDV4TouchQueryReply or ISDV4TouchData results.
Use '-isystem' instead of '-I' to quiet Clang's warnings

Clang by default does not emit warnings for system headers, but
most includes will be added with '-I' which doesn't count as a
system header. This patch has them included with '-isystem' so
that we can more easily see problems with *our* code.