Input: wacom - use full 32-bit HID Usage value in switch statement
authorJason Gerecke <killertofu@gmail.com>
Sat, 19 Apr 2014 20:46:40 +0000 (13:46 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 19 Apr 2014 20:57:34 +0000 (13:57 -0700)
commit5866d9e3b7ecdf96a6089d12bb65736d7c473bce
tree9f856291cb41ed1c3c852b676c2b1cfa84cb219b
parent91ae0e77836b4a13f511b4fc62dc31c523858187
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>
Tested-by: Aaron Skomra <Aaron.Skomra@wacom.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/tablet/wacom_sys.c