static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
{
	struct mt_device *td = hid_get_drvdata(hdev);
	int ret, size = hid_report_len(report);
	u8 *buf;

	/*
	 * Do not fetch the feature report if the device has been explicitly
	 * marked as non-capable.
	 */
	if (td->initial_quirks & HID_QUIRK_NO_INIT_REPORTS)
		return;

	buf = hid_alloc_report_buf(report, GFP_KERNEL);
	if (!buf)
		return;

	ret = hid_hw_raw_request(hdev, report->id, buf, size,
				 HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
	if (ret < 0) {
		dev_warn(&hdev->dev, "failed to fetch feature %d\n",
			 report->id);
	} else {
		ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf,
					   size, 0);
		if (ret)
			dev_warn(&hdev->dev, "failed to report feature\n");
	}

	kfree(buf);
}
Exemple #2
0
static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
{
	struct mt_device *td = hid_get_drvdata(hdev);
	int ret, size = hid_report_len(report);
	u8 *buf;

	/*
	 * Only fetch the feature report if initial reports are not already
	 * been retrieved. Currently this is only done for Windows 8 touch
	 * devices.
	 */
	if (!(hdev->quirks & HID_QUIRK_NO_INIT_REPORTS))
		return;
	if (td->mtclass.name != MT_CLS_WIN_8)
		return;

	buf = hid_alloc_report_buf(report, GFP_KERNEL);
	if (!buf)
		return;

	ret = hid_hw_raw_request(hdev, report->id, buf, size,
				 HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
	if (ret < 0) {
		dev_warn(&hdev->dev, "failed to fetch feature %d\n",
			 report->id);
	} else {
		ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf,
					   size, 0);
		if (ret)
			dev_warn(&hdev->dev, "failed to report feature\n");
	}

	kfree(buf);
}