Skip to content

Commit

Permalink
HID: wacom: Add angular resolution data to some ABS axes
Browse files Browse the repository at this point in the history
Provide the resolution of several angular axes (tilt, pen rotation, puck
rotation) to userspace. Because these values are natively degree-based, we
need to convert them to into units/radian as required by the input_absinfo
struct. To ensure wraparound behaves properly for the rotation axes, the
converted value was rounded up rather than rounded nearest.

Notably, the touchring axes (ABS_WHEEL and ABS_THROTTLE) are left without a
a declared resolution because the their low resolution cannot be accurately
represented (the worst-case rounding-induced error would be ~16 degrees).
Pre-scaling the values and range by at least 10x would reduce the error in
the resolution to acceptable levels, but the xf86-input-wacom driver is not
able to use pre-scaled values for these axes at this time.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jason Gerecke authored and Jiri Kosina committed Nov 21, 2014
1 parent ec5fc1c commit 26fe412
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/hid/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,9 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
0, wacom_wac->features.distance_max, 0, 0);
input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0);
input_abs_set_res(input_dev, ABS_TILT_X, 57);
input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0);
input_abs_set_res(input_dev, ABS_TILT_Y, 57);
}

static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
Expand All @@ -1950,6 +1952,7 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
__set_bit(BTN_TOOL_LENS, input_dev->keybit);

input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_RZ, 287);
input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
}

Expand Down Expand Up @@ -2092,6 +2095,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,

case WACOM_24HD:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
/* fall through */

Expand All @@ -2106,6 +2110,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
case WACOM_BEE:
case CINTIQ:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);

__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);

Expand All @@ -2114,6 +2119,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,

case WACOM_13HD:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
wacom_setup_cintiq(wacom_wac);
break;
Expand All @@ -2122,6 +2128,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
case INTUOS3L:
case INTUOS3S:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
/* fall through */

case INTUOS:
Expand All @@ -2144,6 +2151,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
0, 0);

input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);

wacom_setup_intuos(wacom_wac);
} else if (features->device_type == BTN_TOOL_FINGER) {
Expand All @@ -2162,6 +2170,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
case INTUOS4L:
case INTUOS4S:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
wacom_setup_intuos(wacom_wac);

__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
Expand Down Expand Up @@ -2264,6 +2273,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,

case CINTIQ_HYBRID:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);

wacom_setup_cintiq(wacom_wac);
Expand Down

0 comments on commit 26fe412

Please sign in to comment.