Skip to content

Commit 08a46b4

Browse files
Pinglinuxbentiss
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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 17d793f commit 08a46b4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/hid/wacom_wac.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,7 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
19211921
int fmax = field->logical_maximum;
19221922
unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
19231923
int resolution_code = code;
1924+
int resolution = hidinput_calc_abs_res(field, resolution_code);
19241925

19251926
if (equivalent_usage == HID_DG_TWIST) {
19261927
resolution_code = ABS_RZ;
@@ -1941,8 +1942,15 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
19411942
switch (type) {
19421943
case EV_ABS:
19431944
input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
1944-
input_abs_set_res(input, code,
1945-
hidinput_calc_abs_res(field, resolution_code));
1945+
1946+
/* older tablet may miss physical usage */
1947+
if ((code == ABS_X || code == ABS_Y) && !resolution) {
1948+
resolution = WACOM_INTUOS_RES;
1949+
hid_warn(input,
1950+
"Wacom usage (%d) missing resolution \n",
1951+
code);
1952+
}
1953+
input_abs_set_res(input, code, resolution);
19461954
break;
19471955
case EV_KEY:
19481956
case EV_MSC:

0 commit comments

Comments
 (0)