Lines Matching full:report
81 * Register a new report for a device.
89 struct hid_report *report; in hid_register_report() local
96 report = kzalloc_obj(struct hid_report); in hid_register_report()
97 if (!report) in hid_register_report()
103 report->id = id; in hid_register_report()
104 report->type = type; in hid_register_report()
105 report->size = 0; in hid_register_report()
106 report->device = device; in hid_register_report()
107 report->application = application; in hid_register_report()
108 report_enum->report_id_hash[id] = report; in hid_register_report()
110 list_add_tail(&report->list, &report_enum->report_list); in hid_register_report()
111 INIT_LIST_HEAD(&report->field_entry_list); in hid_register_report()
113 return report; in hid_register_report()
118 * Register a new field for this report.
121 static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages) in hid_register_field() argument
125 if (report->maxfield == HID_MAX_FIELDS) { in hid_register_field()
126 hid_err(report->device, "too many fields in report\n"); in hid_register_field()
136 field->index = report->maxfield++; in hid_register_field()
137 report->field[field->index] = field; in hid_register_field()
142 field->report = report; in hid_register_field()
284 * Register a new field for this report.
289 struct hid_report *report; in hid_add_field() local
299 report = hid_register_report(parser->device, report_type, in hid_add_field()
301 if (!report) { in hid_add_field()
319 offset = report->size; in hid_add_field()
320 report->size += parser->global.report_size * parser->global.report_count; in hid_add_field()
325 /* Total size check: Allow for possible report index byte */ in hid_add_field()
326 if (report->size > (max_buffer_size - 1) << 3) { in hid_add_field()
327 hid_err(parser->device, "report is too long\n"); in hid_add_field()
337 field = hid_register_field(report, usages); in hid_add_field()
688 * Free a report and all registered fields. The field->usage and
693 static void hid_free_report(struct hid_report *report) in hid_free_report() argument
697 kfree(report->field_entries); in hid_free_report()
699 for (n = 0; n < report->maxfield; n++) in hid_free_report()
700 kvfree(report->field[n]); in hid_free_report()
701 kfree(report); in hid_free_report()
705 * Close report. This function returns the device
716 struct hid_report *report = report_enum->report_id_hash[j]; in hid_close_report() local
717 if (report) in hid_close_report()
718 hid_free_report(report); in hid_close_report()
774 * Fetch a report description item from the data stream. We support long
921 * Scan a report descriptor before the device is added to the bus.
948 * we need to use the bpf report descriptor, not the original one. in hid_scan_report()
995 * hid_parse_report - parse device report
998 * @start: report start
999 * @size: report size
1001 * Allocate the device report as read by the bus driver. This function should
1020 * hid_validate_values - validate existing device report's value indexes
1023 * @type: which report type to examine
1024 * @id: which report ID to examine (0 for first)
1025 * @field_index: which report field to examine
1028 * Validate the number of values in a given field of a given report, after
1036 struct hid_report *report; in hid_validate_values() local
1039 hid_err(hid, "invalid HID report type %u\n", type); in hid_validate_values()
1044 hid_err(hid, "invalid HID report id %u\n", id); in hid_validate_values()
1051 * drivers go to access report values. in hid_validate_values()
1056 * report in the list. in hid_validate_values()
1058 report = list_first_entry_or_null( in hid_validate_values()
1062 report = hid->report_enum[type].report_id_hash[id]; in hid_validate_values()
1064 if (!report) { in hid_validate_values()
1068 if (report->maxfield <= field_index) { in hid_validate_values()
1073 if (report->field[field_index]->report_count < report_counts) { in hid_validate_values()
1078 return report; in hid_validate_values()
1132 * to all fields in the report. in hid_apply_multiplier_to_field()
1169 * controls in the report." in hid_apply_multiplier()
1232 /* Ignore if report count is out of bounds. */ in hid_setup_resolution_multiplier()
1248 * hid_open_report - open a driver-specific device report
1252 * Parse a report description into a hid_device structure. Reports are
1288 * on a copy of our report descriptor so it can in hid_open_report()
1350 hid_err(device, "unbalanced collection at end of report description\n"); in hid_open_report()
1354 hid_err(device, "unbalanced delimiter at end of report description\n"); in hid_open_report()
1384 * Extract/implement a data field from/to a little endian report (bit array).
1389 * While the USB HID spec allows unlimited length bit fields in "report
1391 * One model of UPS is claimed to report "LINEV" as a 32-bit field.
1395 static u32 __extract(u8 *report, unsigned offset, int n) in __extract() argument
1405 value |= ((u32)report[idx] >> bit_shift) << bit_nr; in __extract()
1416 u32 hid_field_extract(const struct hid_device *hid, u8 *report, in hid_field_extract() argument
1425 return __extract(report, offset, n); in hid_field_extract()
1438 static void __implement(u8 *report, unsigned offset, int n, u32 value) in __implement() argument
1445 report[idx] &= ~(0xff << bit_shift); in __implement()
1446 report[idx] |= value << bit_shift; in __implement()
1457 report[idx] &= ~(bit_mask << bit_shift); in __implement()
1458 report[idx] |= value << bit_shift; in __implement()
1462 static void implement(const struct hid_device *hid, u8 *report, in implement() argument
1480 __implement(report, offset, n, value); in implement()
1500 * @report: hid report to match against
1502 * compare hid->driver->report_table->report_type to report->type
1504 static int hid_match_report(struct hid_device *hid, struct hid_report *report) in hid_match_report() argument
1513 id->report_type == report->type) in hid_match_report()
1590 * report processing (we do differential reporting to the layer).
1614 /* Ignore report if ErrorRollOver */ in hid_input_fetch_field()
1648 * next report processing (we do differential reporting to the layer).
1688 * Analyse a received report, and fetch the data from it. The field
1689 * content is stored for next report processing (we do differential
1693 struct hid_report *report, in hid_process_report() argument
1702 for (a = 0; a < report->maxfield; a++) in hid_process_report()
1703 hid_input_fetch_field(hid, report->field[a], data); in hid_process_report()
1705 if (!list_empty(&report->field_entry_list)) { in hid_process_report()
1708 &report->field_entry_list, in hid_process_report()
1723 for (a = 0; a < report->maxfield; a++) { in hid_process_report()
1724 field = report->field[a]; in hid_process_report()
1732 for (a = 0; a < report->maxfield; a++) { in hid_process_report()
1733 field = report->field[a]; in hid_process_report()
1745 * of processed usages in the report.
1751 struct hid_report *report, in __hid_insert_field_entry() argument
1764 &report->field_entry_list, in __hid_insert_field_entry()
1777 list_add_tail(&entry->list, &report->field_entry_list); in __hid_insert_field_entry()
1781 struct hid_report *report) in hid_report_process_ordering() argument
1788 /* count the number of individual fields in the report */ in hid_report_process_ordering()
1789 for (a = 0; a < report->maxfield; a++) { in hid_report_process_ordering()
1790 field = report->field[a]; in hid_report_process_ordering()
1803 report->field_entries = entries; in hid_report_process_ordering()
1806 * walk through all fields in the report and in hid_report_process_ordering()
1807 * store them by priority order in report->field_entry_list in hid_report_process_ordering()
1813 for (a = 0; a < report->maxfield; a++) { in hid_report_process_ordering()
1814 field = report->field[a]; in hid_report_process_ordering()
1818 __hid_insert_field_entry(hid, report, in hid_report_process_ordering()
1824 __hid_insert_field_entry(hid, report, &entries[usages], in hid_report_process_ordering()
1833 struct hid_report *report; in hid_process_ordering() local
1836 list_for_each_entry(report, &report_enum->report_list, list) in hid_process_ordering()
1837 hid_report_process_ordering(hid, report); in hid_process_ordering()
1841 * Output the field into the report.
1863 * Compute the size of a report.
1865 static size_t hid_compute_report_size(struct hid_report *report) in hid_compute_report_size() argument
1867 if (report->size) in hid_compute_report_size()
1868 return ((report->size - 1) >> 3) + 1; in hid_compute_report_size()
1874 * Create a report. 'data' has to be allocated using
1878 void hid_output_report(struct hid_report *report, __u8 *data) in hid_output_report() argument
1882 if (report->id > 0) in hid_output_report()
1883 *data++ = report->id; in hid_output_report()
1885 memset(data, 0, hid_compute_report_size(report)); in hid_output_report()
1886 for (n = 0; n < report->maxfield; n++) in hid_output_report()
1887 hid_output_field(report->device, report->field[n], data); in hid_output_report()
1894 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) in hid_alloc_report_buf() argument
1899 * 1 extra byte for the report ID if it is null (not used) so in hid_alloc_report_buf()
1904 u32 len = hid_report_len(report) + 7 + (report->id == 0); in hid_alloc_report_buf()
1911 * Set a field value. The report this field belongs to has to be
1925 hid_dump_input(field->report->device, field->usage + offset, value); in hid_set_field()
1928 hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", in hid_set_field()
1934 hid_err(field->report->device, "value %d is out of range\n", value); in hid_set_field()
1947 struct hid_report *report; in hid_find_field() local
1950 list_for_each_entry(report, report_list, list) { in hid_find_field()
1951 if (report->application != application) in hid_find_field()
1954 for (i = 0; i < report->maxfield; i++) { in hid_find_field()
1955 struct hid_field *field = report->field[i]; in hid_find_field()
1971 struct hid_report *report; in hid_get_report() local
1972 unsigned int n = 0; /* Normally report number is 0 */ in hid_get_report()
1974 /* Device uses numbered reports, data[0] is report number */ in hid_get_report()
1978 report = report_enum->report_id_hash[n]; in hid_get_report()
1979 if (report == NULL) in hid_get_report()
1982 return report; in hid_get_report()
1989 int __hid_request(struct hid_device *hid, struct hid_report *report, in __hid_request() argument
1996 buf = hid_alloc_report_buf(report, GFP_KERNEL); in __hid_request()
2001 len = hid_report_len(report); in __hid_request()
2003 if (report->id == 0) { in __hid_request()
2004 /* reserve the first byte for the report ID */ in __hid_request()
2010 hid_output_report(report, data_buf); in __hid_request()
2012 ret = hid_hw_raw_request(hid, report->id, buf, len, report->type, reqtype); in __hid_request()
2019 hid_input_report(hid, report->type, buf, ret, 0); in __hid_request()
2033 struct hid_report *report; in hid_report_raw_event() local
2040 report = hid_get_report(report_enum, data); in hid_report_raw_event()
2041 if (!report) in hid_report_raw_event()
2049 rsize = hid_compute_report_size(report); in hid_report_raw_event()
2060 dbg_hid("report %d is too short, (%d < %d)\n", report->id, in hid_report_raw_event()
2066 hid->hiddev_report_event(hid, report); in hid_report_raw_event()
2073 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { in hid_report_raw_event()
2074 hid_process_report(hid, report, cdata, interrupt); in hid_report_raw_event()
2076 if (hdrv && hdrv->report) in hid_report_raw_event()
2077 hdrv->report(hid, report); in hid_report_raw_event()
2081 hidinput_report_event(hid, report); in hid_report_raw_event()
2094 struct hid_report *report; in __hid_input_report() local
2122 dbg_hid("empty report\n"); in __hid_input_report()
2131 report = hid_get_report(report_enum, data); in __hid_input_report()
2133 if (!report) { in __hid_input_report()
2138 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { in __hid_input_report()
2139 ret = hdrv->raw_event(hid, report, data, size); in __hid_input_report()
2153 * hid_input_report - report data from lower layer (usb, bt...)
2156 * @type: HID report type (HID_*_REPORT)
2157 * @data: report contents
2457 * hid_hw_request - send report request to device
2460 * @report: report to send
2464 struct hid_report *report, enum hid_class_request reqtype) in hid_hw_request() argument
2467 return hdev->ll_driver->request(hdev, report, reqtype); in hid_hw_request()
2469 __hid_request(hdev, report, reqtype); in hid_hw_request()
2498 * hid_hw_raw_request - send report request to device
2501 * @reportnum: report ID
2504 * @rtype: HID report type
2542 * hid_hw_output_report - send output report to device
2740 /* we keep a reference to the currently scanned report descriptor */ in __hid_device_probe()
2756 /* the report descriptor changed, we need to re-scan it */ in __hid_device_probe()
2929 * Read the device report descriptor once and use as template in hid_add_device()