Lines Matching full:report
54 * Register a new report for a device.
62 struct hid_report *report; in hid_register_report() local
69 report = kzalloc(sizeof(struct hid_report), GFP_KERNEL); in hid_register_report()
70 if (!report) in hid_register_report()
76 report->id = id; in hid_register_report()
77 report->type = type; in hid_register_report()
78 report->size = 0; in hid_register_report()
79 report->device = device; in hid_register_report()
80 report->application = application; in hid_register_report()
81 report_enum->report_id_hash[id] = report; in hid_register_report()
83 list_add_tail(&report->list, &report_enum->report_list); in hid_register_report()
84 INIT_LIST_HEAD(&report->field_entry_list); in hid_register_report()
86 return report; in hid_register_report()
91 * Register a new field for this report.
94 static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages) in hid_register_field() argument
98 if (report->maxfield == HID_MAX_FIELDS) { in hid_register_field()
99 hid_err(report->device, "too many fields in report\n"); in hid_register_field()
109 field->index = report->maxfield++; in hid_register_field()
110 report->field[field->index] = field; in hid_register_field()
115 field->report = report; in hid_register_field()
257 * Register a new field for this report.
262 struct hid_report *report; in hid_add_field() local
271 report = hid_register_report(parser->device, report_type, in hid_add_field()
273 if (!report) { in hid_add_field()
291 offset = report->size; in hid_add_field()
292 report->size += parser->global.report_size * parser->global.report_count; in hid_add_field()
294 /* Total size check: Allow for possible report index byte */ in hid_add_field()
295 if (report->size > (HID_MAX_BUFFER_SIZE - 1) << 3) { in hid_add_field()
296 hid_err(parser->device, "report is too long\n"); in hid_add_field()
306 field = hid_register_field(report, usages); in hid_add_field()
653 * Free a report and all registered fields. The field->usage and
658 static void hid_free_report(struct hid_report *report) in hid_free_report() argument
662 kfree(report->field_entries); in hid_free_report()
664 for (n = 0; n < report->maxfield; n++) in hid_free_report()
665 kfree(report->field[n]); in hid_free_report()
666 kfree(report); in hid_free_report()
670 * Close report. This function returns the device
681 struct hid_report *report = report_enum->report_id_hash[j]; in hid_close_report() local
682 if (report) in hid_close_report()
683 hid_free_report(report); in hid_close_report()
716 * Fetch a report description item from the data stream. We support long
868 * Scan a report descriptor before the device is added to the bus.
933 * hid_parse_report - parse device report
936 * @start: report start
937 * @size: report size
939 * Allocate the device report as read by the bus driver. This function should
958 * hid_validate_values - validate existing device report's value indexes
961 * @type: which report type to examine
962 * @id: which report ID to examine (0 for first)
963 * @field_index: which report field to examine
966 * Validate the number of values in a given field of a given report, after
974 struct hid_report *report; in hid_validate_values() local
977 hid_err(hid, "invalid HID report type %u\n", type); in hid_validate_values()
982 hid_err(hid, "invalid HID report id %u\n", id); in hid_validate_values()
989 * drivers go to access report values. in hid_validate_values()
994 * report in the list. in hid_validate_values()
996 report = list_entry( in hid_validate_values()
1000 report = hid->report_enum[type].report_id_hash[id]; in hid_validate_values()
1002 if (!report) { in hid_validate_values()
1006 if (report->maxfield <= field_index) { in hid_validate_values()
1011 if (report->field[field_index]->report_count < report_counts) { in hid_validate_values()
1016 return report; in hid_validate_values()
1070 * to all fields in the report. in hid_apply_multiplier_to_field()
1107 * controls in the report." in hid_apply_multiplier()
1168 /* Ignore if report count is out of bounds. */ in hid_setup_resolution_multiplier()
1184 * hid_open_report - open a driver-specific device report
1188 * Parse a report description into a hid_device structure. Reports are
1274 hid_err(device, "unbalanced collection at end of report description\n"); in hid_open_report()
1278 hid_err(device, "unbalanced delimiter at end of report description\n"); in hid_open_report()
1348 * Extract/implement a data field from/to a little endian report (bit array).
1353 * While the USB HID spec allows unlimited length bit fields in "report
1355 * One model of UPS is claimed to report "LINEV" as a 32-bit field.
1359 static u32 __extract(u8 *report, unsigned offset, int n) in __extract() argument
1369 value |= ((u32)report[idx] >> bit_shift) << bit_nr; in __extract()
1380 u32 hid_field_extract(const struct hid_device *hid, u8 *report, in hid_field_extract() argument
1389 return __extract(report, offset, n); in hid_field_extract()
1402 static void __implement(u8 *report, unsigned offset, int n, u32 value) in __implement() argument
1409 report[idx] &= ~(0xff << bit_shift); in __implement()
1410 report[idx] |= value << bit_shift; in __implement()
1421 report[idx] &= ~(bit_mask << bit_shift); in __implement()
1422 report[idx] |= value << bit_shift; in __implement()
1426 static void implement(const struct hid_device *hid, u8 *report, in implement() argument
1445 __implement(report, offset, n, value); in implement()
1465 * @report: hid report to match against
1467 * compare hid->driver->report_table->report_type to report->type
1469 static int hid_match_report(struct hid_device *hid, struct hid_report *report) in hid_match_report() argument
1478 id->report_type == report->type) in hid_match_report()
1555 * report processing (we do differential reporting to the layer).
1579 /* Ignore report if ErrorRollOver */ in hid_input_fetch_field()
1613 * next report processing (we do differential reporting to the layer).
1653 * Analyse a received report, and fetch the data from it. The field
1654 * content is stored for next report processing (we do differential
1658 struct hid_report *report, in hid_process_report() argument
1667 for (a = 0; a < report->maxfield; a++) in hid_process_report()
1668 hid_input_fetch_field(hid, report->field[a], data); in hid_process_report()
1670 if (!list_empty(&report->field_entry_list)) { in hid_process_report()
1673 &report->field_entry_list, in hid_process_report()
1688 for (a = 0; a < report->maxfield; a++) { in hid_process_report()
1689 field = report->field[a]; in hid_process_report()
1697 for (a = 0; a < report->maxfield; a++) { in hid_process_report()
1698 field = report->field[a]; in hid_process_report()
1710 * of processed usages in the report.
1716 struct hid_report *report, in __hid_insert_field_entry() argument
1729 &report->field_entry_list, in __hid_insert_field_entry()
1742 list_add_tail(&entry->list, &report->field_entry_list); in __hid_insert_field_entry()
1746 struct hid_report *report) in hid_report_process_ordering() argument
1753 /* count the number of individual fields in the report */ in hid_report_process_ordering()
1754 for (a = 0; a < report->maxfield; a++) { in hid_report_process_ordering()
1755 field = report->field[a]; in hid_report_process_ordering()
1768 report->field_entries = entries; in hid_report_process_ordering()
1771 * walk through all fields in the report and in hid_report_process_ordering()
1772 * store them by priority order in report->field_entry_list in hid_report_process_ordering()
1778 for (a = 0; a < report->maxfield; a++) { in hid_report_process_ordering()
1779 field = report->field[a]; in hid_report_process_ordering()
1783 __hid_insert_field_entry(hid, report, in hid_report_process_ordering()
1789 __hid_insert_field_entry(hid, report, &entries[usages], in hid_report_process_ordering()
1798 struct hid_report *report; in hid_process_ordering() local
1801 list_for_each_entry(report, &report_enum->report_list, list) in hid_process_ordering()
1802 hid_report_process_ordering(hid, report); in hid_process_ordering()
1806 * Output the field into the report.
1828 * Compute the size of a report.
1830 static size_t hid_compute_report_size(struct hid_report *report) in hid_compute_report_size() argument
1832 if (report->size) in hid_compute_report_size()
1833 return ((report->size - 1) >> 3) + 1; in hid_compute_report_size()
1839 * Create a report. 'data' has to be allocated using
1843 void hid_output_report(struct hid_report *report, __u8 *data) in hid_output_report() argument
1847 if (report->id > 0) in hid_output_report()
1848 *data++ = report->id; in hid_output_report()
1850 memset(data, 0, hid_compute_report_size(report)); in hid_output_report()
1851 for (n = 0; n < report->maxfield; n++) in hid_output_report()
1852 hid_output_field(report->device, report->field[n], data); in hid_output_report()
1859 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) in hid_alloc_report_buf() argument
1866 u32 len = hid_report_len(report) + 7; in hid_alloc_report_buf()
1873 * Set a field value. The report this field belongs to has to be
1887 hid_dump_input(field->report->device, field->usage + offset, value); in hid_set_field()
1890 hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", in hid_set_field()
1896 hid_err(field->report->device, "value %d is out of range\n", value); in hid_set_field()
1908 struct hid_report *report; in hid_get_report() local
1909 unsigned int n = 0; /* Normally report number is 0 */ in hid_get_report()
1911 /* Device uses numbered reports, data[0] is report number */ in hid_get_report()
1915 report = report_enum->report_id_hash[n]; in hid_get_report()
1916 if (report == NULL) in hid_get_report()
1919 return report; in hid_get_report()
1926 int __hid_request(struct hid_device *hid, struct hid_report *report, in __hid_request() argument
1933 buf = hid_alloc_report_buf(report, GFP_KERNEL); in __hid_request()
1937 len = hid_report_len(report); in __hid_request()
1940 hid_output_report(report, buf); in __hid_request()
1942 ret = hid->ll_driver->raw_request(hid, report->id, buf, len, in __hid_request()
1943 report->type, reqtype); in __hid_request()
1950 hid_input_report(hid, report->type, buf, ret, 0); in __hid_request()
1964 struct hid_report *report; in hid_report_raw_event() local
1970 report = hid_get_report(report_enum, data); in hid_report_raw_event()
1971 if (!report) in hid_report_raw_event()
1979 rsize = hid_compute_report_size(report); in hid_report_raw_event()
1987 dbg_hid("report %d is too short, (%d < %d)\n", report->id, in hid_report_raw_event()
1993 hid->hiddev_report_event(hid, report); in hid_report_raw_event()
2000 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { in hid_report_raw_event()
2001 hid_process_report(hid, report, cdata, interrupt); in hid_report_raw_event()
2003 if (hdrv && hdrv->report) in hid_report_raw_event()
2004 hdrv->report(hid, report); in hid_report_raw_event()
2008 hidinput_report_event(hid, report); in hid_report_raw_event()
2015 * hid_input_report - report data from lower layer (usb, bt...)
2018 * @type: HID report type (HID_*_REPORT)
2019 * @data: report contents
2030 struct hid_report *report; in hid_input_report() local
2047 dbg_hid("empty report\n"); in hid_input_report()
2056 report = hid_get_report(report_enum, data); in hid_input_report()
2058 if (!report) { in hid_input_report()
2063 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { in hid_input_report()
2064 ret = hdrv->raw_event(hid, report, data, size); in hid_input_report()
2353 * hid_hw_request - send report request to device
2356 * @report: report to send
2360 struct hid_report *report, enum hid_class_request reqtype) in hid_hw_request() argument
2363 return hdev->ll_driver->request(hdev, report, reqtype); in hid_hw_request()
2365 __hid_request(hdev, report, reqtype); in hid_hw_request()
2370 * hid_hw_raw_request - send report request to device
2373 * @reportnum: report ID
2376 * @rtype: HID report type
2396 * hid_hw_output_report - send output report to device
2726 * Read the device report descriptor once and use as template in hid_add_device()
2914 "debugfs is now used for inspecting the device (report descriptor, reports)\n"); in hid_init()