Skip to content

Commit 08790be

Browse files
Ping Chengjigpu
authored andcommitted
backport: HID: wacom: Set a default resolution for older tablets
Some older tablets may not report physical maximum for X/Y coordinates. Set a default to prevent undefined resolution. Signed-off-by: Ping Cheng <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]> [[email protected]: Imported into input-wacom (08a46b4190)] Signed-off-by: Ping Cheng <[email protected]> [[email protected]: Backported from input-wacom (235fcdb)] Signed-off-by: Ping Cheng <[email protected]>
1 parent 21c6b46 commit 08790be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

3.17/wacom_wac.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,7 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
19101910
int fmax = field->logical_maximum;
19111911
unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
19121912
int resolution_code = code;
1913+
int resolution = hidinput_calc_abs_res(field, resolution_code);
19131914

19141915
if (equivalent_usage == HID_DG_TWIST ||
19151916
equivalent_usage == WACOM_HID_WD_TOUCHRING) {
@@ -1931,8 +1932,15 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
19311932
switch (type) {
19321933
case EV_ABS:
19331934
input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
1934-
input_abs_set_res(input, code,
1935-
hidinput_calc_abs_res(field, resolution_code));
1935+
1936+
/* older tablet may miss physical usage */
1937+
if ((code == ABS_X || code == ABS_Y) && !resolution) {
1938+
resolution = WACOM_INTUOS_RES;
1939+
hid_warn(input,
1940+
"Wacom usage (%d) missing resolution \n",
1941+
code);
1942+
}
1943+
input_abs_set_res(input, code, resolution);
19361944
break;
19371945
case EV_KEY:
19381946
case EV_MSC:

0 commit comments

Comments
 (0)