Skip to content

Commit 1b8f9c1

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Defer calculation of resolution until resolution_code is known
The Wacom driver maps the HID_DG_TWIST usage to ABS_Z (rather than ABS_RZ) for historic reasons. When the code to support twist was introduced in commit 50066a0 ("HID: wacom: generic: Add support for height, tilt, and twist usages"), we were careful to write it in such a way that it had HID calculate the resolution of the twist axis assuming ABS_RZ instead (so that we would get correct angular behavior). This was broken with the introduction of commit 08a46b4 ("HID: wacom: Set a default resolution for older tablets"), which moved the resolution calculation to occur *before* the adjustment from ABS_Z to ABS_RZ occurred. This commit moves the calculation of resolution after the point that we are finished setting things up for its proper use. Signed-off-by: Jason Gerecke <[email protected]> Fixes: 08a46b4 ("HID: wacom: Set a default resolution for older tablets") Cc: [email protected] Signed-off-by: Jiri Kosina <[email protected]>
1 parent c8000de commit 1b8f9c1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/hid/wacom_wac.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1878,12 +1878,14 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
18781878
int fmax = field->logical_maximum;
18791879
unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
18801880
int resolution_code = code;
1881-
int resolution = hidinput_calc_abs_res(field, resolution_code);
1881+
int resolution;
18821882

18831883
if (equivalent_usage == HID_DG_TWIST) {
18841884
resolution_code = ABS_RZ;
18851885
}
18861886

1887+
resolution = hidinput_calc_abs_res(field, resolution_code);
1888+
18871889
if (equivalent_usage == HID_GD_X) {
18881890
fmin += features->offset_left;
18891891
fmax -= features->offset_right;

0 commit comments

Comments
 (0)