/** * vivaldi_feature_mapping - Fill out vivaldi keymap data exposed via HID * @hdev: HID device to parse * @field: HID field to parse * @usage: HID usage to parse * * Note: this function assumes that driver data attached to @hdev contains an * instance of &struct vivaldi_data at the very beginning.
*/ void vivaldi_feature_mapping(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage)
{ struct vivaldi_data *data = hid_get_drvdata(hdev); struct hid_report *report = field->report;
u8 *report_data, *buf;
u32 report_len; unsignedint fn_key; int ret;
if (fn_key > data->num_function_row_keys)
data->num_function_row_keys = fn_key;
report_data = buf = hid_alloc_report_buf(report, GFP_KERNEL); if (!report_data) return;
report_len = hid_report_len(report); if (!report->id) { /* * hid_hw_raw_request() will stuff report ID (which will be 0) * into the first byte of the buffer even for unnumbered * reports, so we need to account for this to avoid getting * -EOVERFLOW in return. * Note that hid_alloc_report_buf() adds 7 bytes to the size * so we can safely say that we have space for an extra byte.
*/
report_len++;
}
ret = hid_hw_raw_request(hdev, report->id, report_data,
report_len, HID_FEATURE_REPORT,
HID_REQ_GET_REPORT); if (ret < 0) {
dev_warn(&hdev->dev, "failed to fetch feature %d\n",
field->report->id); goto out;
}
if (!report->id) { /* * Undo the damage from hid_hw_raw_request() for unnumbered * reports.
*/
report_data++;
report_len--;
}
ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data,
report_len, 0); if (ret) {
dev_warn(&hdev->dev, "failed to report feature %d\n",
field->report->id); goto out;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.