Lines Matching refs:hid

350 		field->usage[i].hid = parser->local.usage[j];  in hid_add_field()
758 struct hid_device *hid = container_of(ref, struct hid_device, ref); in hiddev_free() local
760 hid_close_report(hid); in hiddev_free()
761 hid_free_bpf_rdesc(hid); in hiddev_free()
762 kfree(hid->dev_rdesc); in hiddev_free()
763 kfree(hid); in hiddev_free()
768 struct hid_device *hid = to_hid_device(dev); in hid_device_release() local
770 kref_put(&hid->ref, hiddev_free); in hid_device_release()
836 struct hid_device *hid = parser->device; in hid_scan_input_usage() local
839 hid->group = HID_GROUP_MULTITOUCH; in hid_scan_input_usage()
855 struct hid_device *hid = parser->device; in hid_scan_collection() local
861 hid->group = HID_GROUP_SENSOR_HUB; in hid_scan_collection()
863 if (hid->vendor == USB_VENDOR_ID_MICROSOFT && in hid_scan_collection()
864 hid->product == USB_DEVICE_ID_MS_POWER_COVER && in hid_scan_collection()
865 hid->group == HID_GROUP_MULTITOUCH) in hid_scan_collection()
866 hid->group = HID_GROUP_GENERIC; in hid_scan_collection()
925 static int hid_scan_report(struct hid_device *hid) in hid_scan_report() argument
929 const __u8 *start = hid->dev_rdesc; in hid_scan_report()
930 const __u8 *end = start + hid->dev_rsize; in hid_scan_report()
943 parser->device = hid; in hid_scan_report()
944 hid->group = HID_GROUP_GENERIC; in hid_scan_report()
958 (hid->group == HID_GROUP_MULTITOUCH)) in hid_scan_report()
959 hid->group = HID_GROUP_MULTITOUCH_WIN_8; in hid_scan_report()
964 switch (hid->vendor) { in hid_scan_report()
966 hid->group = HID_GROUP_WACOM; in hid_scan_report()
969 if (hid->group == HID_GROUP_GENERIC) in hid_scan_report()
976 hid->group = HID_GROUP_RMI; in hid_scan_report()
995 int hid_parse_report(struct hid_device *hid, const __u8 *start, unsigned size) in hid_parse_report() argument
997 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL); in hid_parse_report()
998 if (!hid->dev_rdesc) in hid_parse_report()
1000 hid->dev_rsize = size; in hid_parse_report()
1022 struct hid_report *hid_validate_values(struct hid_device *hid, in hid_validate_values() argument
1030 hid_err(hid, "invalid HID report type %u\n", type); in hid_validate_values()
1035 hid_err(hid, "invalid HID report id %u\n", id); in hid_validate_values()
1050 &hid->report_enum[type].report_list, in hid_validate_values()
1053 report = hid->report_enum[type].report_id_hash[id]; in hid_validate_values()
1056 hid_err(hid, "missing %s %u\n", hid_report_names[type], id); in hid_validate_values()
1060 hid_err(hid, "not enough fields in %s %u\n", in hid_validate_values()
1065 hid_err(hid, "not enough values in %s %u field %u\n", in hid_validate_values()
1073 static int hid_calculate_multiplier(struct hid_device *hid, in hid_calculate_multiplier() argument
1098 hid_warn(hid, in hid_calculate_multiplier()
1105 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m); in hid_calculate_multiplier()
1112 static void hid_apply_multiplier_to_field(struct hid_device *hid, in hid_apply_multiplier_to_field() argument
1130 collection = &hid->collection[usage->collection_index]; in hid_apply_multiplier_to_field()
1133 collection = &hid->collection[collection->parent_idx]; in hid_apply_multiplier_to_field()
1142 static void hid_apply_multiplier(struct hid_device *hid, in hid_apply_multiplier() argument
1170 multiplier_collection = &hid->collection[multiplier->usage->collection_index]; in hid_apply_multiplier()
1173 multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; in hid_apply_multiplier()
1177 effective_multiplier = hid_calculate_multiplier(hid, multiplier); in hid_apply_multiplier()
1179 rep_enum = &hid->report_enum[HID_INPUT_REPORT]; in hid_apply_multiplier()
1183 hid_apply_multiplier_to_field(hid, field, in hid_apply_multiplier()
1213 void hid_setup_resolution_multiplier(struct hid_device *hid) in hid_setup_resolution_multiplier() argument
1220 rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; in hid_setup_resolution_multiplier()
1229 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER) in hid_setup_resolution_multiplier()
1230 hid_apply_multiplier(hid, in hid_setup_resolution_multiplier()
1407 u32 hid_field_extract(const struct hid_device *hid, u8 *report, in hid_field_extract() argument
1411 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n", in hid_field_extract()
1453 static void implement(const struct hid_device *hid, u8 *report, in implement() argument
1457 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", in implement()
1464 hid_warn(hid, in implement()
1495 static int hid_match_report(struct hid_device *hid, struct hid_report *report) in hid_match_report() argument
1497 const struct hid_report_id *id = hid->driver->report_table; in hid_match_report()
1518 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) in hid_match_usage() argument
1520 const struct hid_usage_id *id = hid->driver->usage_table; in hid_match_usage()
1527 id->usage_hid == usage->hid) && in hid_match_usage()
1536 static void hid_process_event(struct hid_device *hid, struct hid_field *field, in hid_process_event() argument
1539 struct hid_driver *hdrv = hid->driver; in hid_process_event()
1542 if (!list_empty(&hid->debug_list)) in hid_process_event()
1543 hid_dump_input(hid, usage, value); in hid_process_event()
1545 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { in hid_process_event()
1546 ret = hdrv->event(hid, field, usage, value); in hid_process_event()
1549 hid_err(hid, "%s's event failed with %d\n", in hid_process_event()
1555 if (hid->claimed & HID_CLAIMED_INPUT) in hid_process_event()
1556 hidinput_hid_event(hid, field, usage, value); in hid_process_event()
1557 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) in hid_process_event()
1558 hid->hiddev_hid_event(hid, field, usage, value); in hid_process_event()
1583 static void hid_input_fetch_field(struct hid_device *hid, in hid_input_fetch_field() argument
1601 snto32(hid_field_extract(hid, data, offset + n * size, in hid_input_fetch_field()
1603 hid_field_extract(hid, data, offset + n * size, size); in hid_input_fetch_field()
1608 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) { in hid_input_fetch_field()
1619 static void hid_input_var_field(struct hid_device *hid, in hid_input_var_field() argument
1628 hid_process_event(hid, in hid_input_var_field()
1642 static void hid_input_array_field(struct hid_device *hid, in hid_input_array_field() argument
1660 hid_process_event(hid, in hid_input_array_field()
1668 hid_process_event(hid, in hid_input_array_field()
1683 static void hid_process_report(struct hid_device *hid, in hid_process_report() argument
1694 hid_input_fetch_field(hid, report->field[a], data); in hid_process_report()
1704 hid_process_event(hid, in hid_process_report()
1710 hid_input_array_field(hid, field, interrupt); in hid_process_report()
1727 hid_input_var_field(hid, field, interrupt); in hid_process_report()
1729 hid_input_array_field(hid, field, interrupt); in hid_process_report()
1741 static void __hid_insert_field_entry(struct hid_device *hid, in __hid_insert_field_entry() argument
1771 static void hid_report_process_ordering(struct hid_device *hid, in hid_report_process_ordering() argument
1809 __hid_insert_field_entry(hid, report, in hid_report_process_ordering()
1815 __hid_insert_field_entry(hid, report, &entries[usages], in hid_report_process_ordering()
1822 static void hid_process_ordering(struct hid_device *hid) in hid_process_ordering() argument
1825 struct hid_report_enum *report_enum = &hid->report_enum[HID_INPUT_REPORT]; in hid_process_ordering()
1828 hid_report_process_ordering(hid, report); in hid_process_ordering()
1835 static void hid_output_field(const struct hid_device *hid, in hid_output_field() argument
1845 implement(hid, data, offset + n * size, size, in hid_output_field()
1848 implement(hid, data, offset + n * size, size, in hid_output_field()
1949 if (field->usage[j].hid == usage) in hid_find_field()
1980 int __hid_request(struct hid_device *hid, struct hid_report *report, in __hid_request() argument
2003 ret = hid_hw_raw_request(hid, report->id, buf, len, report->type, reqtype); in __hid_request()
2010 hid_input_report(hid, report->type, buf, ret, 0); in __hid_request()
2020 int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, in hid_report_raw_event() argument
2023 struct hid_report_enum *report_enum = hid->report_enum + type; in hid_report_raw_event()
2042 if (hid->ll_driver->max_buffer_size) in hid_report_raw_event()
2043 max_buffer_size = hid->ll_driver->max_buffer_size; in hid_report_raw_event()
2056 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) in hid_report_raw_event()
2057 hid->hiddev_report_event(hid, report); in hid_report_raw_event()
2058 if (hid->claimed & HID_CLAIMED_HIDRAW) { in hid_report_raw_event()
2059 ret = hidraw_report_event(hid, data, size); in hid_report_raw_event()
2064 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { in hid_report_raw_event()
2065 hid_process_report(hid, report, cdata, interrupt); in hid_report_raw_event()
2066 hdrv = hid->driver; in hid_report_raw_event()
2068 hdrv->report(hid, report); in hid_report_raw_event()
2071 if (hid->claimed & HID_CLAIMED_INPUT) in hid_report_raw_event()
2072 hidinput_report_event(hid, report); in hid_report_raw_event()
2079 static int __hid_input_report(struct hid_device *hid, enum hid_report_type type, in __hid_input_report() argument
2088 if (!hid) in __hid_input_report()
2091 ret = down_trylock(&hid->driver_input_lock); in __hid_input_report()
2093 up(&hid->driver_input_lock); in __hid_input_report()
2099 if (!hid->driver) { in __hid_input_report()
2103 report_enum = hid->report_enum + type; in __hid_input_report()
2104 hdrv = hid->driver; in __hid_input_report()
2106 data = dispatch_hid_bpf_device_event(hid, type, data, &size, interrupt, source, from_bpf); in __hid_input_report()
2119 if (!list_empty(&hid->debug_list)) in __hid_input_report()
2120 hid_dump_report(hid, type, data, size); in __hid_input_report()
2129 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { in __hid_input_report()
2130 ret = hdrv->raw_event(hid, report, data, size); in __hid_input_report()
2135 ret = hid_report_raw_event(hid, type, data, size, interrupt); in __hid_input_report()
2139 up(&hid->driver_input_lock); in __hid_input_report()
2154 int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, in hid_input_report() argument
2157 return __hid_input_report(hid, type, data, size, interrupt, 0, in hid_input_report()
3070 int hid_check_keys_pressed(struct hid_device *hid) in hid_check_keys_pressed() argument
3075 if (!(hid->claimed & HID_CLAIMED_INPUT)) in hid_check_keys_pressed()
3078 list_for_each_entry(hidinput, &hid->inputs, list) { in hid_check_keys_pressed()