Skip to content

Commit 49374f0

Browse files
author
Jiri Kosina
committed
Merge branch 'for-5.1/wacom' into for-linus
Wacom driver cleanups from Gustavo A. R. Silva and Jason Gerecke Support for Pro Pen slim from Jason Gerecke
2 parents 9f66d83 + 4e6e7d7 commit 49374f0

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

drivers/hid/wacom_sys.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,38 @@ static void wacom_hid_usage_quirk(struct hid_device *hdev,
252252
}
253253
}
254254

255+
/*
256+
* Wacom's AES devices use different vendor-defined usages to
257+
* report serial number information compared to their branded
258+
* hardware. The usages are also sometimes ill-defined and do
259+
* not have the correct logical min/max values set. Lets patch
260+
* the descriptor to use the branded usage convention and fix
261+
* the errors.
262+
*/
263+
if (usage->hid == WACOM_HID_WT_SERIALNUMBER &&
264+
field->report_size == 16 &&
265+
field->index + 2 < field->report->maxfield) {
266+
struct hid_field *a = field->report->field[field->index + 1];
267+
struct hid_field *b = field->report->field[field->index + 2];
268+
269+
if (a->maxusage > 0 &&
270+
a->usage[0].hid == HID_DG_TOOLSERIALNUMBER &&
271+
a->report_size == 32 &&
272+
b->maxusage > 0 &&
273+
b->usage[0].hid == 0xFF000000 &&
274+
b->report_size == 8) {
275+
features->quirks |= WACOM_QUIRK_AESPEN;
276+
usage->hid = WACOM_HID_WD_TOOLTYPE;
277+
field->logical_minimum = S16_MIN;
278+
field->logical_maximum = S16_MAX;
279+
a->logical_minimum = S32_MIN;
280+
a->logical_maximum = S32_MAX;
281+
b->usage[0].hid = WACOM_HID_WD_SERIALHI;
282+
b->logical_minimum = 0;
283+
b->logical_maximum = U8_MAX;
284+
}
285+
}
286+
255287
/* 2nd-generation Intuos Pro Large has incorrect Y maximum */
256288
if (hdev->vendor == USB_VENDOR_ID_WACOM &&
257289
hdev->product == 0x0358 &&

drivers/hid/wacom_wac.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ static int wacom_intuos_get_tool_type(int tool_id)
626626
case 0x8e2: /* IntuosHT2 pen */
627627
case 0x022:
628628
case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */
629+
case 0x10842: /* MobileStudio Pro Pro Pen slim */
629630
case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */
630631
case 0x16802: /* Cintiq 13HD Pro Pen */
631632
case 0x18802: /* DTH2242 Pen */
@@ -667,6 +668,7 @@ static int wacom_intuos_get_tool_type(int tool_id)
667668
case 0x1480a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */
668669
case 0x1090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
669670
case 0x1080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */
671+
case 0x1084a: /* MobileStudio Pro Pro Pen slim Eraser */
670672
case 0x1680a: /* Cintiq 13HD Pro Pen Eraser */
671673
case 0x1880a: /* DTH2242 Eraser */
672674
case 0x1080a: /* Intuos4/5 13HD/24HD General Pen Eraser */
@@ -2159,27 +2161,6 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
21592161
case HID_DG_TOOLSERIALNUMBER:
21602162
features->quirks |= WACOM_QUIRK_TOOLSERIAL;
21612163
wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0);
2162-
2163-
/* Adjust AES usages to match modern convention */
2164-
if (usage->hid == WACOM_HID_WT_SERIALNUMBER && field->report_size == 16) {
2165-
if (field->index + 2 < field->report->maxfield) {
2166-
struct hid_field *a = field->report->field[field->index + 1];
2167-
struct hid_field *b = field->report->field[field->index + 2];
2168-
2169-
if (a->maxusage > 0 && a->usage[0].hid == HID_DG_TOOLSERIALNUMBER && a->report_size == 32 &&
2170-
b->maxusage > 0 && b->usage[0].hid == 0xFF000000 && b->report_size == 8) {
2171-
features->quirks |= WACOM_QUIRK_AESPEN;
2172-
usage->hid = WACOM_HID_WD_TOOLTYPE;
2173-
field->logical_minimum = S16_MIN;
2174-
field->logical_maximum = S16_MAX;
2175-
a->logical_minimum = S32_MIN;
2176-
a->logical_maximum = S32_MAX;
2177-
b->usage[0].hid = WACOM_HID_WD_SERIALHI;
2178-
b->logical_minimum = 0;
2179-
b->logical_maximum = U8_MAX;
2180-
}
2181-
}
2182-
}
21832164
break;
21842165
case WACOM_HID_WD_SENSE:
21852166
features->quirks |= WACOM_QUIRK_SENSE;
@@ -3525,6 +3506,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
35253506
switch (features->type) {
35263507
case GRAPHIRE_BT:
35273508
__clear_bit(ABS_MISC, input_dev->absbit);
3509+
/* fall through */
35283510

35293511
case WACOM_MO:
35303512
case WACOM_G4:

0 commit comments

Comments
 (0)