HID: wacom: generic: Add support for vendor-defined "Distance" usage
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>
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 6c2f0e4..f78ad77 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1442,7 +1442,8 @@
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 @@
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;