Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ffffd52 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina
Browse files

HID: wacom: fix timeout on probe for some wacoms



Some Wacom tablets (at least the ISDv4 found in the Lenovo X230) timeout
during probe while retrieving the input reports.
The only time this information is valuable is during the feature_mapping
stage, so we can ask for it there and discard the generic input reports
retrieval.

This gives a code path closer to the wacom.ko driver when it was in the
input subtree (not HID).

Cc: stable@vger.kernel.org # requires cherry-pick of c64d8834
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 12969e3b
Loading
Loading
Loading
Loading
+16 −2
Original line number Original line Diff line number Diff line
@@ -110,12 +110,24 @@ static void wacom_feature_mapping(struct hid_device *hdev,
{
{
	struct wacom *wacom = hid_get_drvdata(hdev);
	struct wacom *wacom = hid_get_drvdata(hdev);
	struct wacom_features *features = &wacom->wacom_wac.features;
	struct wacom_features *features = &wacom->wacom_wac.features;
	u8 *data;
	int ret;


	switch (usage->hid) {
	switch (usage->hid) {
	case HID_DG_CONTACTMAX:
	case HID_DG_CONTACTMAX:
		/* leave touch_max as is if predefined */
		/* leave touch_max as is if predefined */
		if (!features->touch_max)
		if (!features->touch_max) {
			features->touch_max = field->value[0];
			/* read manually */
			data = kzalloc(2, GFP_KERNEL);
			if (!data)
				break;
			data[0] = field->report->id;
			ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
						data, 2, 0);
			if (ret == 2)
				features->touch_max = data[1];
			kfree(data);
		}
		break;
		break;
	}
	}
}
}
@@ -1280,6 +1292,8 @@ static int wacom_probe(struct hid_device *hdev,
	if (!id->driver_data)
	if (!id->driver_data)
		return -EINVAL;
		return -EINVAL;


	hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;

	wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
	wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
	if (!wacom)
	if (!wacom)
		return -ENOMEM;
		return -ENOMEM;