Skip to content

Commit 235fcdb

Browse files
Ping Chengjigpu
authored andcommitted
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]>
1 parent 8a31d08 commit 235fcdb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

4.5/wacom_wac.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,7 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
19381938
int fmax = field->logical_maximum;
19391939
unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
19401940
int resolution_code = code;
1941+
int resolution = hidinput_calc_abs_res(field, resolution_code);
19411942

19421943
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
19431944
if (equivalent_usage == HID_DG_TWIST) {
@@ -1963,8 +1964,16 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
19631964
switch (type) {
19641965
case EV_ABS:
19651966
input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
1966-
input_abs_set_res(input, code,
1967-
hidinput_calc_abs_res(field, resolution_code));
1967+
1968+
/* older tablet may miss physical usage */
1969+
if ((code == ABS_X || code == ABS_Y) && !resolution) {
1970+
resolution = WACOM_INTUOS_RES;
1971+
hid_warn(input,
1972+
"Wacom usage (%d) missing resolution \n",
1973+
code);
1974+
}
1975+
input_abs_set_res(input, code, resolution);
1976+
break;
19681977
break;
19691978
case EV_KEY:
19701979
case EV_MSC:

0 commit comments

Comments
 (0)