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); }
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); }
static int gfrm_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { unsigned long hdev_type = (unsigned long) hid_get_drvdata(hdev); int ret = 0; if (hdev_type != GFRM100) return 0; if (size < 2 || data[0] != GFRM100_SEARCH_KEY_REPORT_ID) return 0; /* * Convert GFRM100 Search key reports into Consumer.0221 (Key.Search) * reports. Ignore audio data. */ switch (data[1]) { case GFRM100_SEARCH_KEY_DOWN: ret = hid_report_raw_event(hdev, HID_INPUT_REPORT, search_key_dn, sizeof(search_key_dn), 1); break; case GFRM100_SEARCH_KEY_AUDIO_DATA: break; case GFRM100_SEARCH_KEY_UP: ret = hid_report_raw_event(hdev, HID_INPUT_REPORT, search_key_up, sizeof(search_key_up), 1); break; default: break; } return (ret < 0) ? ret : -1; }
static int px_raw_event(struct hid_device *hid, struct hid_report *report, u8 *data, int size) { int idx = size; switch (report->id) { case 0: /* keyboard input */ /* * Convert in-band modifier key values into out of band * modifier bits and pull the key strokes from the report. * Thus a report data set which looked like: * * [00][00][E0][30][00][00][00][00] * (no modifier bits + "Left Shift" key + "1" key) * * Would be converted to: * * [01][00][00][30][00][00][00][00] * (Left Shift modifier bit + "1" key) * * As long as it's in the size range, the upper level * drivers don't particularly care if there are in-band * 0-valued keys, so they don't stop parsing. */ while (--idx > 1) { if (data[idx] < 0xE0 || data[idx] > 0xE7) continue; data[0] |= (1 << (data[idx] - 0xE0)); data[idx] = 0; } hid_report_raw_event(hid, HID_INPUT_REPORT, data, size, 0); return 1; default: /* unknown report */ /* Unknown report type; pass upstream */ hid_info(hid, "unknown report type %d\n", report->id); break; } return 0; }
static int px_raw_event(struct hid_device *hid, struct hid_report *report, u8 *data, int size) { int idx = size; switch (report->id) { case 0: while (--idx > 1) { if (data[idx] < 0xE0 || data[idx] > 0xE7) continue; data[0] |= (1 << (data[idx] - 0xE0)); data[idx] = 0; } hid_report_raw_event(hid, HID_INPUT_REPORT, data, size, 0); return 1; default: hid_info(hid, "unknown report type %d\n", report->id); break; } return 0; }