Skip to content

Commit 184eccd

Browse files
skomraJiri Kosina
authored andcommitted
HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report
In the generic code path, HID_DG_CONTACTMAX was previously only read from the second byte of report 0x23. Another report (0x82) has the HID_DG_CONTACTMAX in the higher nibble of the third byte. We should support reading the value of HID_DG_CONTACTMAX no matter what report we are reading or which position that value is in. To do this we submit the feature report as a event report using hid_report_raw_event(). Our modified finger event path records the value of HID_DG_CONTACTMAX when it sees that usage. Fixes: 8ffffd5 ("HID: wacom: fix timeout on probe for some wacoms") Signed-off-by: Aaron Armstrong Skomra <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 912c6aa commit 184eccd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/hid/wacom_sys.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,16 @@ static void wacom_feature_mapping(struct hid_device *hdev,
314314
/* leave touch_max as is if predefined */
315315
if (!features->touch_max) {
316316
/* read manually */
317-
data = kzalloc(2, GFP_KERNEL);
317+
n = hid_report_len(field->report);
318+
data = hid_alloc_report_buf(field->report, GFP_KERNEL);
318319
if (!data)
319320
break;
320321
data[0] = field->report->id;
321322
ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
322-
data, 2, WAC_CMD_RETRIES);
323-
if (ret == 2) {
324-
features->touch_max = data[1];
323+
data, n, WAC_CMD_RETRIES);
324+
if (ret == n) {
325+
ret = hid_report_raw_event(hdev,
326+
HID_FEATURE_REPORT, data, n, 0);
325327
} else {
326328
features->touch_max = 16;
327329
hid_warn(hdev, "wacom_feature_mapping: "

drivers/hid/wacom_wac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,6 +2492,7 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
24922492
struct wacom *wacom = hid_get_drvdata(hdev);
24932493
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
24942494
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
2495+
struct wacom_features *features = &wacom->wacom_wac.features;
24952496

24962497
switch (equivalent_usage) {
24972498
case HID_GD_X:
@@ -2512,6 +2513,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
25122513
case HID_DG_TIPSWITCH:
25132514
wacom_wac->hid_data.tipswitch = value;
25142515
break;
2516+
case HID_DG_CONTACTMAX:
2517+
features->touch_max = value;
2518+
return;
25152519
}
25162520

25172521

0 commit comments

Comments
 (0)