Directly index into the various *keys arrays

The 'keys' array is indexed into by reference to the X11 button
number stored in the 'buttons' array. While this may have been
useful at some point in time, the benefits have since gone and
left behind nothing but headaches.

Note that because the association with X11 buttons has been
removed, action mapping (via xsetwacom) no longer depends on
on the raw mapping (via xorg.conf). For instance, on a system
which has 'Option "Button3" "1"' set, use of the command
'xsetwacom set <id> button 1 10' will no longer cause *both*
button 1 and button 3 to emit button 10. Its unlikely anyone
relies on this quirk, but can be easily worked around if
necessary.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Replace multiple default variables with arrays

Storing the defaults for strips and wheels in individual
variables makes updating and scanning through them very
tedious. This patch replaces the variables with arrays
and introduces new #define statements to keep the level
of semantic meaning we had.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Remove support for 8-bit (raw button) strip/ring properties

This patch removes the ability to set up the touchstrips or
touchrings with raw 8-bit button numbers. Buttons have been
without this ability for quite some time, and this brings
these two properties in line.

This patch will break applications which rely on the use
of raw buttons in the properties, but the actual fallout is
expected to be minimal. Applications which don't understand
Actions are already broken (since they can't work with buttons)
and those that do understand Actions but don't use them can
be easily modified.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Cleanup call chain for action properties

This patch rewrites the call chains used for setting the three
action properties by introducing a single function to handle
the 'Actions' properties, and a single function for 'Action'
properties. Functions which were merely helper functions have
been inlined if appropriate.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Initialize action properties from defaults

This patch adds functions capable of resetting the action
properties (button/stip/wheel) to their default, and calls
them on initialization.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reset-on-None for Actions property

This patch adds the ability to reset an individual Action by
setting the corresponding element of an Actions property to
the 'None' atom (i.e. 0). When encountered, the None will be
replaced with an atom representing the default Action. This
will let the driver behave as it currently does once raw
button support is removed.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Remove raw button fallback codepaths from wcmCommon

With actions now defined on initialization and reset to default
when given a 'None' action, we can remove the raw button codepaths
without a noticible change in driver behavior.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Internally use physical button numbering for actions

One should not have to keep in mind the historic quirk that
mouse buttons 4-7 have when dealing with buttons events generated
by the tablet. This patch isolates conversion between physical
and X11 numbering to the single place it has historically
mattered: the button property getters/setters.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Add missing newline to error message

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Set WCM_LCD on the Cintiq 24HD

This flag was apparently forgotten when the 24HD was originally
added.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Use signal-safe logging patches where necessary

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <pinglinux@gmail.com>
Log debug messages in signal-safe manner

This is a rather broad brush, logging all messages in DBG() through the
signal-safe interface instead of just the ones that really need it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <pinglinux@gmail.com>
Pre-allocate the tap timer

wcmSingleFingerTap() is called during SIGIO, calling TimerSet(NULL, ...)
will malloc inside the signal handler and hang the box.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Chris Bagwell <chris@cnpbagwell.com>
Update test to match new function signature

The getWheelButton function's signature was changed in commit 40ecdcb5
but the tests were not updated to reflect this.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Make test_get_wheel_button happy

Apparently there is some subtle difference here between returning
a pointer and using a double-pointer as an output parameter.
Tracing through the function shows the former *should* be working,
but for an unknown reason fails "assert(action == &action_dn)"...

This patch shouldn't change any functionality -- it just shuts up
`make distcheck`.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Add xf86MsgVerb to fake-symbols to let 'make distcheck' complete

The switch from 'xf86Msg' to 'xf86MsgVerb' introduced in commit
e4c1af41 requires that we define the latter in our fake-symbols
so that the test suite can compile correctly.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
wacom 0.16.99.1

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
wacom 0.17.0

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Use kernel-reported tilt range and resolution

Use tilt range and, optionally, resolution reported by the kernel for event
devices.

Add a constant for resolution currently expected by applications: TILT_RES,
1 point per degree in kernel units (points/radian). Scale values to this
resolution for compatibility and specify it for corresponding valuators
(instead of 1) for future use by applications.

Add constants for currently reported value limits: TILT_MIN and TILT_MAX,
-64 and 63 respectively. Continue clamping values to [TILT_MIN, TILT_MAX]
for compatibility.

Values and ranges reported by currently supported tablets should remain
unchanged.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Add LogMessageVerbSigSafe to fake-symbols

Somehow overlooked this while adding 'xf86MsgVerb' to fake-symbols.
Oops.

Reported-by: Timo Aaltonen <tjaalton@ubuntu.com>
Signed-off-by: Jason Gerecke <killertofu@gmail.com>