Lines Matching refs:hid

316 		field->usage[i].hid = parser->local.usage[j];  in hid_add_field()
703 struct hid_device *hid = to_hid_device(dev); in hid_device_release() local
705 hid_close_report(hid); in hid_device_release()
706 kfree(hid->dev_rdesc); in hid_device_release()
707 kfree(hid); in hid_device_release()
779 struct hid_device *hid = parser->device; in hid_scan_input_usage() local
782 hid->group = HID_GROUP_MULTITOUCH; in hid_scan_input_usage()
798 struct hid_device *hid = parser->device; in hid_scan_collection() local
803 hid->group = HID_GROUP_SENSOR_HUB; in hid_scan_collection()
805 if (hid->vendor == USB_VENDOR_ID_MICROSOFT && in hid_scan_collection()
806 hid->product == USB_DEVICE_ID_MS_POWER_COVER && in hid_scan_collection()
807 hid->group == HID_GROUP_MULTITOUCH) in hid_scan_collection()
808 hid->group = HID_GROUP_GENERIC; in hid_scan_collection()
867 static int hid_scan_report(struct hid_device *hid) in hid_scan_report() argument
871 __u8 *start = hid->dev_rdesc; in hid_scan_report()
872 __u8 *end = start + hid->dev_rsize; in hid_scan_report()
885 parser->device = hid; in hid_scan_report()
886 hid->group = HID_GROUP_GENERIC; in hid_scan_report()
900 (hid->group == HID_GROUP_MULTITOUCH)) in hid_scan_report()
901 hid->group = HID_GROUP_MULTITOUCH_WIN_8; in hid_scan_report()
906 switch (hid->vendor) { in hid_scan_report()
908 hid->group = HID_GROUP_WACOM; in hid_scan_report()
911 if (hid->group == HID_GROUP_GENERIC) in hid_scan_report()
918 hid->group = HID_GROUP_RMI; in hid_scan_report()
937 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size) in hid_parse_report() argument
939 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL); in hid_parse_report()
940 if (!hid->dev_rdesc) in hid_parse_report()
942 hid->dev_rsize = size; in hid_parse_report()
964 struct hid_report *hid_validate_values(struct hid_device *hid, in hid_validate_values() argument
972 hid_err(hid, "invalid HID report type %u\n", type); in hid_validate_values()
977 hid_err(hid, "invalid HID report id %u\n", id); in hid_validate_values()
992 hid->report_enum[type].report_list.next, in hid_validate_values()
995 report = hid->report_enum[type].report_id_hash[id]; in hid_validate_values()
998 hid_err(hid, "missing %s %u\n", hid_report_names[type], id); in hid_validate_values()
1002 hid_err(hid, "not enough fields in %s %u\n", in hid_validate_values()
1007 hid_err(hid, "not enough values in %s %u field %u\n", in hid_validate_values()
1015 static int hid_calculate_multiplier(struct hid_device *hid, in hid_calculate_multiplier() argument
1040 hid_warn(hid, in hid_calculate_multiplier()
1047 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m); in hid_calculate_multiplier()
1054 static void hid_apply_multiplier_to_field(struct hid_device *hid, in hid_apply_multiplier_to_field() argument
1072 collection = &hid->collection[usage->collection_index]; in hid_apply_multiplier_to_field()
1075 collection = &hid->collection[collection->parent_idx]; in hid_apply_multiplier_to_field()
1084 static void hid_apply_multiplier(struct hid_device *hid, in hid_apply_multiplier() argument
1112 multiplier_collection = &hid->collection[multiplier->usage->collection_index]; in hid_apply_multiplier()
1115 multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; in hid_apply_multiplier()
1117 effective_multiplier = hid_calculate_multiplier(hid, multiplier); in hid_apply_multiplier()
1119 rep_enum = &hid->report_enum[HID_INPUT_REPORT]; in hid_apply_multiplier()
1123 hid_apply_multiplier_to_field(hid, field, in hid_apply_multiplier()
1153 void hid_setup_resolution_multiplier(struct hid_device *hid) in hid_setup_resolution_multiplier() argument
1160 rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; in hid_setup_resolution_multiplier()
1169 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER) in hid_setup_resolution_multiplier()
1170 hid_apply_multiplier(hid, in hid_setup_resolution_multiplier()
1372 u32 hid_field_extract(const struct hid_device *hid, u8 *report, in hid_field_extract() argument
1376 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n", in hid_field_extract()
1418 static void implement(const struct hid_device *hid, u8 *report, in implement() argument
1422 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", in implement()
1429 hid_warn(hid, in implement()
1461 static int hid_match_report(struct hid_device *hid, struct hid_report *report) in hid_match_report() argument
1463 const struct hid_report_id *id = hid->driver->report_table; in hid_match_report()
1484 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) in hid_match_usage() argument
1486 const struct hid_usage_id *id = hid->driver->usage_table; in hid_match_usage()
1493 id->usage_hid == usage->hid) && in hid_match_usage()
1502 static void hid_process_event(struct hid_device *hid, struct hid_field *field, in hid_process_event() argument
1505 struct hid_driver *hdrv = hid->driver; in hid_process_event()
1508 if (!list_empty(&hid->debug_list)) in hid_process_event()
1509 hid_dump_input(hid, usage, value); in hid_process_event()
1511 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { in hid_process_event()
1512 ret = hdrv->event(hid, field, usage, value); in hid_process_event()
1515 hid_err(hid, "%s's event failed with %d\n", in hid_process_event()
1521 if (hid->claimed & HID_CLAIMED_INPUT) in hid_process_event()
1522 hidinput_hid_event(hid, field, usage, value); in hid_process_event()
1523 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) in hid_process_event()
1524 hid->hiddev_hid_event(hid, field, usage, value); in hid_process_event()
1533 static void hid_input_field(struct hid_device *hid, struct hid_field *field, in hid_input_field() argument
1551 snto32(hid_field_extract(hid, data, offset + n * size, in hid_input_field()
1553 hid_field_extract(hid, data, offset + n * size, size); in hid_input_field()
1559 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) in hid_input_field()
1566 hid_process_event(hid, field, &field->usage[n], value[n], interrupt); in hid_input_field()
1572 && field->usage[field->value[n] - min].hid in hid_input_field()
1574 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); in hid_input_field()
1578 && field->usage[value[n] - min].hid in hid_input_field()
1580 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); in hid_input_field()
1592 static void hid_output_field(const struct hid_device *hid, in hid_output_field() argument
1602 implement(hid, data, offset + n * size, size, in hid_output_field()
1605 implement(hid, data, offset + n * size, size, in hid_output_field()
1709 int __hid_request(struct hid_device *hid, struct hid_report *report, in __hid_request() argument
1725 ret = hid->ll_driver->raw_request(hid, report->id, buf, len, in __hid_request()
1733 hid_input_report(hid, report->type, buf, ret, 0); in __hid_request()
1743 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size, in hid_report_raw_event() argument
1746 struct hid_report_enum *report_enum = hid->report_enum + type; in hid_report_raw_event()
1776 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) in hid_report_raw_event()
1777 hid->hiddev_report_event(hid, report); in hid_report_raw_event()
1778 if (hid->claimed & HID_CLAIMED_HIDRAW) { in hid_report_raw_event()
1779 ret = hidraw_report_event(hid, data, size); in hid_report_raw_event()
1784 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { in hid_report_raw_event()
1786 hid_input_field(hid, report->field[a], cdata, interrupt); in hid_report_raw_event()
1787 hdrv = hid->driver; in hid_report_raw_event()
1789 hdrv->report(hid, report); in hid_report_raw_event()
1792 if (hid->claimed & HID_CLAIMED_INPUT) in hid_report_raw_event()
1793 hidinput_report_event(hid, report); in hid_report_raw_event()
1810 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt) in hid_input_report() argument
1817 if (!hid) in hid_input_report()
1820 if (down_trylock(&hid->driver_input_lock)) in hid_input_report()
1823 if (!hid->driver) { in hid_input_report()
1827 report_enum = hid->report_enum + type; in hid_input_report()
1828 hdrv = hid->driver; in hid_input_report()
1837 if (!list_empty(&hid->debug_list)) in hid_input_report()
1838 hid_dump_report(hid, type, data, size); in hid_input_report()
1847 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { in hid_input_report()
1848 ret = hdrv->raw_event(hid, report, data, size); in hid_input_report()
1853 ret = hid_report_raw_event(hid, type, data, size, interrupt); in hid_input_report()
1856 up(&hid->driver_input_lock); in hid_input_report()
2572 int hid_check_keys_pressed(struct hid_device *hid) in hid_check_keys_pressed() argument
2577 if (!(hid->claimed & HID_CLAIMED_INPUT)) in hid_check_keys_pressed()
2580 list_for_each_entry(hidinput, &hid->inputs, list) { in hid_check_keys_pressed()