]> git.karo-electronics.de Git - linux-beck.git/commitdiff
HID: wacom: generic: Add support for vendor-defined "Distance" usage
authorJason Gerecke <killertofu@gmail.com>
Thu, 20 Oct 2016 01:03:44 +0000 (18:03 -0700)
committerJiri Kosina <jkosina@suse.cz>
Thu, 20 Oct 2016 07:53:57 +0000 (09:53 +0200)
The vendor-defined 0xFF0D01032 ("Distance") usage is nearly equivalent to
HID_GD_Z, except that the axis direction is inverted. Unlike HID_GD_Z which
increases in value as the pen-to-surface distance is decreased, this usage
decreases. Treat this usage as a special case to ensure we don't invert the
scale to be ABS_DISTANCE compatible like we do for HID_GD_Z.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_wac.c
drivers/hid/wacom_wac.h

index 6c2f0e4baf7dc3a8b66c86b636b6d291a8758fae..f78ad77d9ed78392ed92ac8e5ea0eb1f9616c3c1 100644 (file)
@@ -1442,7 +1442,8 @@ static int wacom_equivalent_usage(int usage)
                int subusage = (usage & 0xFF);
 
                if (subpage == WACOM_HID_SP_DIGITIZER ||
-                   subpage == WACOM_HID_SP_DIGITIZERINFO) {
+                   subpage == WACOM_HID_SP_DIGITIZERINFO ||
+                   usage == WACOM_HID_WD_DISTANCE) {
                        return usage;
                }
 
@@ -1502,6 +1503,7 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
        case HID_GD_Y:
                wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4);
                break;
+       case WACOM_HID_WD_DISTANCE:
        case HID_GD_Z:
                wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0);
                break;
index ba914bad971f9909094ba3f6b9b73ba54cf2b00d..63a5a2586707df6e846008aade8679d2010a1282 100644 (file)
@@ -88,6 +88,7 @@
 #define WACOM_HID_SP_DIGITIZER          0x000d0000
 #define WACOM_HID_SP_DIGITIZERINFO      0x00100000
 #define WACOM_HID_WD_DIGITIZER          (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
+#define WACOM_HID_WD_DISTANCE           (WACOM_HID_UP_WACOMDIGITIZER | 0x0132)
 #define WACOM_HID_WD_DATAMODE           (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)
 #define WACOM_HID_UP_G9                 0xff090000
 #define WACOM_HID_G9_PEN                (WACOM_HID_UP_G9 | 0x02)