Commit 8993c673 authored by Aaron Armstrong Skomra's avatar Aaron Armstrong Skomra Committed by Greg Kroah-Hartman

HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report

commit 184eccd4 upstream.

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: 8ffffd52 ("HID: wacom: fix timeout on probe for some wacoms")
Signed-off-by: default avatarAaron Armstrong Skomra <aaron.skomra@wacom.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2a0aa8a0
...@@ -282,14 +282,16 @@ static void wacom_feature_mapping(struct hid_device *hdev, ...@@ -282,14 +282,16 @@ static void wacom_feature_mapping(struct hid_device *hdev,
/* leave touch_max as is if predefined */ /* leave touch_max as is if predefined */
if (!features->touch_max) { if (!features->touch_max) {
/* read manually */ /* read manually */
data = kzalloc(2, GFP_KERNEL); n = hid_report_len(field->report);
data = hid_alloc_report_buf(field->report, GFP_KERNEL);
if (!data) if (!data)
break; break;
data[0] = field->report->id; data[0] = field->report->id;
ret = wacom_get_report(hdev, HID_FEATURE_REPORT, ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
data, 2, WAC_CMD_RETRIES); data, n, WAC_CMD_RETRIES);
if (ret == 2) { if (ret == n) {
features->touch_max = data[1]; ret = hid_report_raw_event(hdev,
HID_FEATURE_REPORT, data, n, 0);
} else { } else {
features->touch_max = 16; features->touch_max = 16;
hid_warn(hdev, "wacom_feature_mapping: " hid_warn(hdev, "wacom_feature_mapping: "
......
...@@ -2533,6 +2533,7 @@ static void wacom_wac_finger_event(struct hid_device *hdev, ...@@ -2533,6 +2533,7 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
struct wacom *wacom = hid_get_drvdata(hdev); struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
struct wacom_features *features = &wacom->wacom_wac.features;
switch (equivalent_usage) { switch (equivalent_usage) {
case HID_GD_X: case HID_GD_X:
...@@ -2553,6 +2554,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev, ...@@ -2553,6 +2554,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
case HID_DG_TIPSWITCH: case HID_DG_TIPSWITCH:
wacom_wac->hid_data.tipswitch = value; wacom_wac->hid_data.tipswitch = value;
break; break;
case HID_DG_CONTACTMAX:
features->touch_max = value;
return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment