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()
950 if (hid->bpf_rdesc && hid->bpf_rsize) { in hid_scan_report()
951 start = hid->bpf_rdesc; in hid_scan_report()
952 end = start + hid->bpf_rsize; in hid_scan_report()
967 (hid->group == HID_GROUP_MULTITOUCH)) in hid_scan_report()
968 hid->group = HID_GROUP_MULTITOUCH_WIN_8; in hid_scan_report()
973 switch (hid->vendor) { in hid_scan_report()
975 hid->group = HID_GROUP_WACOM; in hid_scan_report()
978 if (hid->group == HID_GROUP_GENERIC) in hid_scan_report()
985 hid->group = HID_GROUP_RMI; in hid_scan_report()
1004 int hid_parse_report(struct hid_device *hid, const __u8 *start, unsigned size) in hid_parse_report() argument
1006 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL); in hid_parse_report()
1007 if (!hid->dev_rdesc) in hid_parse_report()
1009 hid->dev_rsize = size; in hid_parse_report()
1031 struct hid_report *hid_validate_values(struct hid_device *hid, in hid_validate_values() argument
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()
1059 &hid->report_enum[type].report_list, in hid_validate_values()
1062 report = hid->report_enum[type].report_id_hash[id]; in hid_validate_values()
1065 hid_err(hid, "missing %s %u\n", hid_report_names[type], id); in hid_validate_values()
1069 hid_err(hid, "not enough fields in %s %u\n", in hid_validate_values()
1074 hid_err(hid, "not enough values in %s %u field %u\n", in hid_validate_values()
1082 static int hid_calculate_multiplier(struct hid_device *hid, in hid_calculate_multiplier() argument
1107 hid_warn(hid, in hid_calculate_multiplier()
1114 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m); in hid_calculate_multiplier()
1121 static void hid_apply_multiplier_to_field(struct hid_device *hid, in hid_apply_multiplier_to_field() argument
1139 collection = &hid->collection[usage->collection_index]; in hid_apply_multiplier_to_field()
1142 collection = &hid->collection[collection->parent_idx]; in hid_apply_multiplier_to_field()
1151 static void hid_apply_multiplier(struct hid_device *hid, in hid_apply_multiplier() argument
1179 multiplier_collection = &hid->collection[multiplier->usage->collection_index]; in hid_apply_multiplier()
1182 multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; in hid_apply_multiplier()
1186 effective_multiplier = hid_calculate_multiplier(hid, multiplier); in hid_apply_multiplier()
1188 rep_enum = &hid->report_enum[HID_INPUT_REPORT]; in hid_apply_multiplier()
1192 hid_apply_multiplier_to_field(hid, field, in hid_apply_multiplier()
1222 void hid_setup_resolution_multiplier(struct hid_device *hid) in hid_setup_resolution_multiplier() argument
1229 rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; in hid_setup_resolution_multiplier()
1238 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER) in hid_setup_resolution_multiplier()
1239 hid_apply_multiplier(hid, in hid_setup_resolution_multiplier()
1416 u32 hid_field_extract(const struct hid_device *hid, u8 *report, in hid_field_extract() argument
1420 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n", in hid_field_extract()
1462 static void implement(const struct hid_device *hid, u8 *report, in implement() argument
1466 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", in implement()
1473 hid_warn(hid, in implement()
1504 static int hid_match_report(struct hid_device *hid, struct hid_report *report) in hid_match_report() argument
1506 const struct hid_report_id *id = hid->driver->report_table; in hid_match_report()
1527 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) in hid_match_usage() argument
1529 const struct hid_usage_id *id = hid->driver->usage_table; in hid_match_usage()
1536 id->usage_hid == usage->hid) && in hid_match_usage()
1545 static void hid_process_event(struct hid_device *hid, struct hid_field *field, in hid_process_event() argument
1548 struct hid_driver *hdrv = hid->driver; in hid_process_event()
1551 if (!list_empty(&hid->debug_list)) in hid_process_event()
1552 hid_dump_input(hid, usage, value); in hid_process_event()
1554 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { in hid_process_event()
1555 ret = hdrv->event(hid, field, usage, value); in hid_process_event()
1558 hid_err(hid, "%s's event failed with %d\n", in hid_process_event()
1564 if (hid->claimed & HID_CLAIMED_INPUT) in hid_process_event()
1565 hidinput_hid_event(hid, field, usage, value); in hid_process_event()
1566 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) in hid_process_event()
1567 hid->hiddev_hid_event(hid, field, usage, value); in hid_process_event()
1592 static void hid_input_fetch_field(struct hid_device *hid, in hid_input_fetch_field() argument
1610 snto32(hid_field_extract(hid, data, offset + n * size, in hid_input_fetch_field()
1612 hid_field_extract(hid, data, offset + n * size, size); in hid_input_fetch_field()
1617 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) { in hid_input_fetch_field()
1628 static void hid_input_var_field(struct hid_device *hid, in hid_input_var_field() argument
1637 hid_process_event(hid, in hid_input_var_field()
1651 static void hid_input_array_field(struct hid_device *hid, in hid_input_array_field() argument
1669 hid_process_event(hid, in hid_input_array_field()
1677 hid_process_event(hid, in hid_input_array_field()
1692 static void hid_process_report(struct hid_device *hid, in hid_process_report() argument
1703 hid_input_fetch_field(hid, report->field[a], data); in hid_process_report()
1713 hid_process_event(hid, in hid_process_report()
1719 hid_input_array_field(hid, field, interrupt); in hid_process_report()
1736 hid_input_var_field(hid, field, interrupt); in hid_process_report()
1738 hid_input_array_field(hid, field, interrupt); in hid_process_report()
1750 static void __hid_insert_field_entry(struct hid_device *hid, in __hid_insert_field_entry() argument
1780 static void hid_report_process_ordering(struct hid_device *hid, in hid_report_process_ordering() argument
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()
1831 static void hid_process_ordering(struct hid_device *hid) in hid_process_ordering() argument
1834 struct hid_report_enum *report_enum = &hid->report_enum[HID_INPUT_REPORT]; in hid_process_ordering()
1837 hid_report_process_ordering(hid, report); in hid_process_ordering()
1844 static void hid_output_field(const struct hid_device *hid, in hid_output_field() argument
1854 implement(hid, data, offset + n * size, size, in hid_output_field()
1857 implement(hid, data, offset + n * size, size, in hid_output_field()
1958 if (field->usage[j].hid == usage) in hid_find_field()
1989 int __hid_request(struct hid_device *hid, struct hid_report *report, in __hid_request() argument
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()
2029 int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, in hid_report_raw_event() argument
2032 struct hid_report_enum *report_enum = hid->report_enum + type; in hid_report_raw_event()
2051 if (hid->ll_driver->max_buffer_size) in hid_report_raw_event()
2052 max_buffer_size = hid->ll_driver->max_buffer_size; in hid_report_raw_event()
2065 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) in hid_report_raw_event()
2066 hid->hiddev_report_event(hid, report); in hid_report_raw_event()
2067 if (hid->claimed & HID_CLAIMED_HIDRAW) { in hid_report_raw_event()
2068 ret = hidraw_report_event(hid, data, size); 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()
2075 hdrv = hid->driver; in hid_report_raw_event()
2077 hdrv->report(hid, report); in hid_report_raw_event()
2080 if (hid->claimed & HID_CLAIMED_INPUT) in hid_report_raw_event()
2081 hidinput_report_event(hid, report); in hid_report_raw_event()
2088 static int __hid_input_report(struct hid_device *hid, enum hid_report_type type, in __hid_input_report() argument
2097 if (!hid) in __hid_input_report()
2100 ret = down_trylock(&hid->driver_input_lock); in __hid_input_report()
2102 up(&hid->driver_input_lock); in __hid_input_report()
2108 if (!hid->driver) { in __hid_input_report()
2112 report_enum = hid->report_enum + type; in __hid_input_report()
2113 hdrv = hid->driver; in __hid_input_report()
2115 data = dispatch_hid_bpf_device_event(hid, type, data, &size, interrupt, source, from_bpf); in __hid_input_report()
2128 if (!list_empty(&hid->debug_list)) in __hid_input_report()
2129 hid_dump_report(hid, type, data, size); 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()
2144 ret = hid_report_raw_event(hid, type, data, size, interrupt); in __hid_input_report()
2148 up(&hid->driver_input_lock); in __hid_input_report()
2163 int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, in hid_input_report() argument
2166 return __hid_input_report(hid, type, data, size, interrupt, 0, in hid_input_report()
3098 int hid_check_keys_pressed(struct hid_device *hid) in hid_check_keys_pressed() argument
3103 if (!(hid->claimed & HID_CLAIMED_INPUT)) in hid_check_keys_pressed()
3106 list_for_each_entry(hidinput, &hid->inputs, list) { in hid_check_keys_pressed()