diff options
author | Jason Gerecke <killertofu@gmail.com> | 2014-11-18 19:50:09 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-11-21 16:39:38 -0500 |
commit | 26fe41245f43c86f65cae272a2851dd792e443f7 (patch) | |
tree | f541ebf838543c0a1d619b1b7c66e058e4ce446d /drivers | |
parent | ec5fc1c1bdf0c445d2669ca9e1dbb69c9725856a (diff) |
HID: wacom: Add angular resolution data to some ABS axes
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/wacom_wac.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 74c9fbde5695..9565d31262ec 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -1930,7 +1930,9 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) | |||
1930 | 0, wacom_wac->features.distance_max, 0, 0); | 1930 | 0, wacom_wac->features.distance_max, 0, 0); |
1931 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); | 1931 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
1932 | input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0); | 1932 | input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0); |
1933 | input_abs_set_res(input_dev, ABS_TILT_X, 57); | ||
1933 | input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0); | 1934 | input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0); |
1935 | input_abs_set_res(input_dev, ABS_TILT_Y, 57); | ||
1934 | } | 1936 | } |
1935 | 1937 | ||
1936 | static void wacom_setup_intuos(struct wacom_wac *wacom_wac) | 1938 | static void wacom_setup_intuos(struct wacom_wac *wacom_wac) |
@@ -1950,6 +1952,7 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac) | |||
1950 | __set_bit(BTN_TOOL_LENS, input_dev->keybit); | 1952 | __set_bit(BTN_TOOL_LENS, input_dev->keybit); |
1951 | 1953 | ||
1952 | input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); | 1954 | input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); |
1955 | input_abs_set_res(input_dev, ABS_RZ, 287); | ||
1953 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); | 1956 | input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); |
1954 | } | 1957 | } |
1955 | 1958 | ||
@@ -2092,6 +2095,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2092 | 2095 | ||
2093 | case WACOM_24HD: | 2096 | case WACOM_24HD: |
2094 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2097 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2098 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2095 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | 2099 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
2096 | /* fall through */ | 2100 | /* fall through */ |
2097 | 2101 | ||
@@ -2106,6 +2110,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2106 | case WACOM_BEE: | 2110 | case WACOM_BEE: |
2107 | case CINTIQ: | 2111 | case CINTIQ: |
2108 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2112 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2113 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2109 | 2114 | ||
2110 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 2115 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
2111 | 2116 | ||
@@ -2114,6 +2119,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2114 | 2119 | ||
2115 | case WACOM_13HD: | 2120 | case WACOM_13HD: |
2116 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2121 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2122 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2117 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 2123 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
2118 | wacom_setup_cintiq(wacom_wac); | 2124 | wacom_setup_cintiq(wacom_wac); |
2119 | break; | 2125 | break; |
@@ -2122,6 +2128,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2122 | case INTUOS3L: | 2128 | case INTUOS3L: |
2123 | case INTUOS3S: | 2129 | case INTUOS3S: |
2124 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2130 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2131 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2125 | /* fall through */ | 2132 | /* fall through */ |
2126 | 2133 | ||
2127 | case INTUOS: | 2134 | case INTUOS: |
@@ -2144,6 +2151,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2144 | 0, 0); | 2151 | 0, 0); |
2145 | 2152 | ||
2146 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2153 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2154 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2147 | 2155 | ||
2148 | wacom_setup_intuos(wacom_wac); | 2156 | wacom_setup_intuos(wacom_wac); |
2149 | } else if (features->device_type == BTN_TOOL_FINGER) { | 2157 | } else if (features->device_type == BTN_TOOL_FINGER) { |
@@ -2162,6 +2170,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2162 | case INTUOS4L: | 2170 | case INTUOS4L: |
2163 | case INTUOS4S: | 2171 | case INTUOS4S: |
2164 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2172 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2173 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2165 | wacom_setup_intuos(wacom_wac); | 2174 | wacom_setup_intuos(wacom_wac); |
2166 | 2175 | ||
2167 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 2176 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
@@ -2264,6 +2273,7 @@ int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, | |||
2264 | 2273 | ||
2265 | case CINTIQ_HYBRID: | 2274 | case CINTIQ_HYBRID: |
2266 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2275 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2276 | input_abs_set_res(input_dev, ABS_Z, 287); | ||
2267 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 2277 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
2268 | 2278 | ||
2269 | wacom_setup_cintiq(wacom_wac); | 2279 | wacom_setup_cintiq(wacom_wac); |