input-wacom 0.21.0

Signed-off-by: Aaron Skomra <skomra@gmail.com>
backport: Input: wacom - Export battery scope

This will stop UPower from detecting the tablet as a power supply,
and using its battery status to hibernate or switch off the machine.

https://bugs.freedesktop.org/show_bug.cgi?id=70321

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Input: wacom - use full 32-bit HID Usage value in switch statement

A HID Usage is a 32-bit value: an upper 16-bit "page" and a lower 16-bit
ID. While the two halves are normally reported seperately, only the
combination uniquely idenfifes a particular HID Usage.

The existing code performs the comparison in two steps, first performing a
switch on the ID and then verifying the page within each case. While this
works fine, it is very akward to handle two Usages that share a single ID,
such as HID_USAGE_PRESSURE and HID_USAGE_X because the case statement can
only have a single identifier.

To work around this, we now check the full 32-bit HID Usage directly rather
than first checking the ID and then the page.  This allows the switch
statement to have distinct cases for e.g. HID_USAGE_PRESSURE and
HID_USAGE_X.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Input: wacom - override 'pressure_max' with value from HID_USAGE_PRESSURE

The 0xEC sensor is used in multiple tablet PCs and curiously has versions
that report 256 levels of pressure (Samsung Slate 7) as well as versions
that report 1024 levels (Lenovo Thinkpad Yoga).  To allow both versions to
work properly, we allow the value of HID_USAGE_PRESSURE reported to
override pressure_max.

 ** HISTORIC NOTE **

In the 2.6.30 tree, we had some basic pressure support. However,
according to the comments, there wasn't actually a reported
maximum. We currently expect a logical maximum following this,
but that apparently doesn't always hold. It was forced to 255
here.

Also, apparently fingers used to report the amount of sensed
capacitance (a reasonable indicator of pressure) and included
info in the HID descriptor. (HID_USAGE_DESKTOP << 16 | HID_USAGE_UNDEFINED)
stored a 16-bit value at report[i+3] just like our current
pressure. This test was removed from the mainline a few years
ago because the the reported capacitance values were generally
too bogus to be useful.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Input: wacom - references to 'wacom->data' should use 'unsigned char*'

'wacom->data' contains raw binary data and can lead to unexpected behavior
if a byte under examination happens to have its MSB set.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Input: wacom - handle 1024 pressure levels in wacom_tpc_pen

Some tablet PC sensors (e.g. the 0xEC found in the Thinkpad Yoga) report
more than 256 pressure levels and will experience wraparound unless the
full range is read.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Input: wacom - add support for ISDv4 0x10E sensor

Used in the Fujitsu T732

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>