Lines Matching defs:report

54  * Register a new report for a device.
62 struct hid_report *report;
69 report = kzalloc(sizeof(struct hid_report), GFP_KERNEL);
70 if (!report)
76 report->id = id;
77 report->type = type;
78 report->size = 0;
79 report->device = device;
80 report->application = application;
81 report_enum->report_id_hash[id] = report;
83 list_add_tail(&report->list, &report_enum->report_list);
85 return report;
90 * Register a new field for this report.
93 static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
97 if (report->maxfield == HID_MAX_FIELDS) {
98 hid_err(report->device, "too many fields in report\n");
108 field->index = report->maxfield++;
109 report->field[field->index] = field;
112 field->report = report;
254 * Register a new field for this report.
259 struct hid_report *report;
269 report = hid_register_report(parser->device, report_type,
271 if (!report) {
289 offset = report->size;
290 report->size += parser->global.report_size * parser->global.report_count;
295 /* Total size check: Allow for possible report index byte */
296 if (report->size > (max_buffer_size - 1) << 3) {
297 hid_err(parser->device, "report is too long\n");
307 field = hid_register_field(report, usages);
654 * Free a report and all registered fields. The field->usage and
659 static void hid_free_report(struct hid_report *report)
663 for (n = 0; n < report->maxfield; n++)
664 kfree(report->field[n]);
665 kfree(report);
669 * Close report. This function returns the device
680 struct hid_report *report = report_enum->report_id_hash[j];
681 if (report)
682 hid_free_report(report);
722 * Fetch a report description item from the data stream. We support long
874 * Scan a report descriptor before the device is added to the bus.
939 * hid_parse_report - parse device report
942 * @start: report start
943 * @size: report size
945 * Allocate the device report as read by the bus driver. This function should
964 * hid_validate_values - validate existing device report's value indexes
967 * @type: which report type to examine
968 * @id: which report ID to examine (0 for first)
969 * @field_index: which report field to examine
972 * Validate the number of values in a given field of a given report, after
980 struct hid_report *report;
983 hid_err(hid, "invalid HID report type %u\n", type);
988 hid_err(hid, "invalid HID report id %u\n", id);
995 * drivers go to access report values.
1000 * report in the list.
1002 report = list_first_entry_or_null(
1006 report = hid->report_enum[type].report_id_hash[id];
1008 if (!report) {
1012 if (report->maxfield <= field_index) {
1017 if (report->field[field_index]->report_count < report_counts) {
1022 return report;
1076 * to all fields in the report.
1113 * controls in the report."
1174 /* Ignore if report count is out of bounds. */
1190 * hid_open_report - open a driver-specific device report
1194 * Parse a report description into a hid_device structure. Reports are
1283 hid_err(device, "unbalanced collection at end of report description\n");
1287 hid_err(device, "unbalanced delimiter at end of report description\n");
1357 * Extract/implement a data field from/to a little endian report (bit array).
1362 * While the USB HID spec allows unlimited length bit fields in "report
1364 * One model of UPS is claimed to report "LINEV" as a 32-bit field.
1368 static u32 __extract(u8 *report, unsigned offset, int n)
1378 value |= ((u32)report[idx] >> bit_shift) << bit_nr;
1389 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1398 return __extract(report, offset, n);
1411 static void __implement(u8 *report, unsigned offset, int n, u32 value)
1418 report[idx] &= ~(0xff << bit_shift);
1419 report[idx] |= value << bit_shift;
1430 report[idx] &= ~(bit_mask << bit_shift);
1431 report[idx] |= value << bit_shift;
1435 static void implement(const struct hid_device *hid, u8 *report,
1453 __implement(report, offset, n, value);
1473 * @report: hid report to match against
1475 * compare hid->driver->report_table->report_type to report->type
1477 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1486 id->report_type == report->type)
1545 * content is stored for next report processing (we do differential
1571 /* Ignore report if ErrorRollOver */
1605 * Output the field into the report.
1627 * Compute the size of a report.
1629 static size_t hid_compute_report_size(struct hid_report *report)
1631 if (report->size)
1632 return ((report->size - 1) >> 3) + 1;
1638 * Create a report. 'data' has to be allocated using
1642 void hid_output_report(struct hid_report *report, __u8 *data)
1646 if (report->id > 0)
1647 *data++ = report->id;
1649 memset(data, 0, hid_compute_report_size(report));
1650 for (n = 0; n < report->maxfield; n++)
1651 hid_output_field(report->device, report->field[n], data);
1658 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
1665 u32 len = hid_report_len(report) + 7;
1672 * Set a field value. The report this field belongs to has to be
1686 hid_dump_input(field->report->device, field->usage + offset, value);
1689 hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n",
1695 hid_err(field->report->device, "value %d is out of range\n", value);
1707 struct hid_report *report;
1708 unsigned int n = 0; /* Normally report number is 0 */
1710 /* Device uses numbered reports, data[0] is report number */
1714 report = report_enum->report_id_hash[n];
1715 if (report == NULL)
1718 return report;
1725 int __hid_request(struct hid_device *hid, struct hid_report *report,
1732 buf = hid_alloc_report_buf(report, GFP_KERNEL);
1736 len = hid_report_len(report);
1739 hid_output_report(report, buf);
1741 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1742 report->type, reqtype);
1749 hid_input_report(hid, report->type, buf, ret, 0);
1763 struct hid_report *report;
1771 report = hid_get_report(report_enum, data);
1772 if (!report)
1780 rsize = hid_compute_report_size(report);
1791 dbg_hid("report %d is too short, (%d < %d)\n", report->id,
1797 hid->hiddev_report_event(hid, report);
1804 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1805 for (a = 0; a < report->maxfield; a++)
1806 hid_input_field(hid, report->field[a], cdata, interrupt);
1808 if (hdrv && hdrv->report)
1809 hdrv->report(hid, report);
1813 hidinput_report_event(hid, report);
1820 * hid_input_report - report data from lower layer (usb, bt...)
1823 * @type: HID report type (HID_*_REPORT)
1824 * @data: report contents
1834 struct hid_report *report;
1851 dbg_hid("empty report\n");
1860 report = hid_get_report(report_enum, data);
1862 if (!report) {
1867 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1868 ret = hdrv->raw_event(hid, report, data, size);
2432 * Read the device report descriptor once and use as template
2622 "debugfs is now used for inspecting the device (report descriptor, reports)\n");