Lines Matching defs:report

49  * Register a new report for a device.
57 struct hid_report *report;
64 report = kzalloc(sizeof(struct hid_report), GFP_KERNEL);
65 if (!report)
71 report->id = id;
72 report->type = type;
73 report->size = 0;
74 report->device = device;
75 report->application = application;
76 report_enum->report_id_hash[id] = report;
78 list_add_tail(&report->list, &report_enum->report_list);
79 INIT_LIST_HEAD(&report->field_entry_list);
81 return report;
86 * Register a new field for this report.
89 static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
93 if (report->maxfield == HID_MAX_FIELDS) {
94 hid_err(report->device, "too many fields in report\n");
104 field->index = report->maxfield++;
105 report->field[field->index] = field;
110 field->report = report;
252 * Register a new field for this report.
257 struct hid_report *report;
267 report = hid_register_report(parser->device, report_type,
269 if (!report) {
287 offset = report->size;
288 report->size += parser->global.report_size * parser->global.report_count;
293 /* Total size check: Allow for possible report index byte */
294 if (report->size > (max_buffer_size - 1) << 3) {
295 hid_err(parser->device, "report is too long\n");
305 field = hid_register_field(report, usages);
652 * Free a report and all registered fields. The field->usage and
657 static void hid_free_report(struct hid_report *report)
661 kfree(report->field_entries);
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
875 * Scan a report descriptor before the device is added to the bus.
940 * hid_parse_report - parse device report
943 * @start: report start
944 * @size: report size
946 * Allocate the device report as read by the bus driver. This function should
965 * hid_validate_values - validate existing device report's value indexes
968 * @type: which report type to examine
969 * @id: which report ID to examine (0 for first)
970 * @field_index: which report field to examine
973 * Validate the number of values in a given field of a given report, after
981 struct hid_report *report;
984 hid_err(hid, "invalid HID report type %u\n", type);
989 hid_err(hid, "invalid HID report id %u\n", id);
996 * drivers go to access report values.
1001 * report in the list.
1003 report = list_first_entry_or_null(
1007 report = hid->report_enum[type].report_id_hash[id];
1009 if (!report) {
1013 if (report->maxfield <= field_index) {
1018 if (report->field[field_index]->report_count < report_counts) {
1023 return report;
1077 * to all fields in the report.
1114 * controls in the report."
1175 /* Ignore if report count is out of bounds. */
1191 * hid_open_report - open a driver-specific device report
1195 * Parse a report description into a hid_device structure. Reports are
1285 hid_err(device, "unbalanced collection at end of report description\n");
1289 hid_err(device, "unbalanced delimiter at end of report description\n");
1359 * Extract/implement a data field from/to a little endian report (bit array).
1364 * While the USB HID spec allows unlimited length bit fields in "report
1366 * One model of UPS is claimed to report "LINEV" as a 32-bit field.
1370 static u32 __extract(u8 *report, unsigned offset, int n)
1380 value |= ((u32)report[idx] >> bit_shift) << bit_nr;
1391 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1400 return __extract(report, offset, n);
1413 static void __implement(u8 *report, unsigned offset, int n, u32 value)
1420 report[idx] &= ~(0xff << bit_shift);
1421 report[idx] |= value << bit_shift;
1432 report[idx] &= ~(bit_mask << bit_shift);
1433 report[idx] |= value << bit_shift;
1437 static void implement(const struct hid_device *hid, u8 *report,
1456 __implement(report, offset, n, value);
1476 * @report: hid report to match against
1478 * compare hid->driver->report_table->report_type to report->type
1480 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1489 id->report_type == report->type)
1566 * report processing (we do differential reporting to the layer).
1590 /* Ignore report if ErrorRollOver */
1624 * next report processing (we do differential reporting to the layer).
1664 * Analyse a received report, and fetch the data from it. The field
1665 * content is stored for next report processing (we do differential
1669 struct hid_report *report,
1678 for (a = 0; a < report->maxfield; a++)
1679 hid_input_fetch_field(hid, report->field[a], data);
1681 if (!list_empty(&report->field_entry_list)) {
1684 &report->field_entry_list,
1699 for (a = 0; a < report->maxfield; a++) {
1700 field = report->field[a];
1708 for (a = 0; a < report->maxfield; a++) {
1709 field = report->field[a];
1721 * of processed usages in the report.
1727 struct hid_report *report,
1740 &report->field_entry_list,
1753 list_add_tail(&entry->list, &report->field_entry_list);
1757 struct hid_report *report)
1764 /* count the number of individual fields in the report */
1765 for (a = 0; a < report->maxfield; a++) {
1766 field = report->field[a];
1779 report->field_entries = entries;
1782 * walk through all fields in the report and
1783 * store them by priority order in report->field_entry_list
1789 for (a = 0; a < report->maxfield; a++) {
1790 field = report->field[a];
1794 __hid_insert_field_entry(hid, report,
1800 __hid_insert_field_entry(hid, report, &entries[usages],
1809 struct hid_report *report;
1812 list_for_each_entry(report, &report_enum->report_list, list)
1813 hid_report_process_ordering(hid, report);
1817 * Output the field into the report.
1839 * Compute the size of a report.
1841 static size_t hid_compute_report_size(struct hid_report *report)
1843 if (report->size)
1844 return ((report->size - 1) >> 3) + 1;
1850 * Create a report. 'data' has to be allocated using
1854 void hid_output_report(struct hid_report *report, __u8 *data)
1858 if (report->id > 0)
1859 *data++ = report->id;
1861 memset(data, 0, hid_compute_report_size(report));
1862 for (n = 0; n < report->maxfield; n++)
1863 hid_output_field(report->device, report->field[n], data);
1870 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
1877 u32 len = hid_report_len(report) + 7;
1884 * Set a field value. The report this field belongs to has to be
1898 hid_dump_input(field->report->device, field->usage + offset, value);
1901 hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n",
1907 hid_err(field->report->device, "value %d is out of range\n", value);
1919 struct hid_report *report;
1920 unsigned int n = 0; /* Normally report number is 0 */
1922 /* Device uses numbered reports, data[0] is report number */
1926 report = report_enum->report_id_hash[n];
1927 if (report == NULL)
1930 return report;
1937 int __hid_request(struct hid_device *hid, struct hid_report *report,
1944 buf = hid_alloc_report_buf(report, GFP_KERNEL);
1948 len = hid_report_len(report);
1951 hid_output_report(report, buf);
1953 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1954 report->type, reqtype);
1961 hid_input_report(hid, report->type, buf, ret, 0);
1975 struct hid_report *report;
1982 report = hid_get_report(report_enum, data);
1983 if (!report)
1991 rsize = hid_compute_report_size(report);
2002 dbg_hid("report %d is too short, (%d < %d)\n", report->id,
2008 hid->hiddev_report_event(hid, report);
2015 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
2016 hid_process_report(hid, report, cdata, interrupt);
2018 if (hdrv && hdrv->report)
2019 hdrv->report(hid, report);
2023 hidinput_report_event(hid, report);
2030 * hid_input_report - report data from lower layer (usb, bt...)
2033 * @type: HID report type (HID_*_REPORT)
2034 * @data: report contents
2045 struct hid_report *report;
2068 dbg_hid("empty report\n");
2077 report = hid_get_report(report_enum, data);
2079 if (!report) {
2084 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
2085 ret = hdrv->raw_event(hid, report, data, size);
2380 * hid_hw_request - send report request to device
2383 * @report: report to send
2387 struct hid_report *report, enum hid_class_request reqtype)
2390 return hdev->ll_driver->request(hdev, report, reqtype);
2392 __hid_request(hdev, report, reqtype);
2397 * hid_hw_raw_request - send report request to device
2400 * @reportnum: report ID
2403 * @rtype: HID report type
2428 * hid_hw_output_report - send output report to device
2787 * Read the device report descriptor once and use as template