Lines Matching defs:hid
31 #include <linux/hid.h>
33 #include <linux/hid-debug.h>
36 #include "hid-ids.h"
346 field->usage[i].hid = parser->local.usage[j];
718 * will be allocated by hid-core and needs to be freed.
750 struct hid_device *hid = container_of(ref, struct hid_device, ref);
752 hid_close_report(hid);
753 hid_free_bpf_rdesc(hid);
754 kfree(hid->dev_rdesc);
755 kfree(hid);
760 struct hid_device *hid = to_hid_device(dev);
762 kref_put(&hid->ref, hiddev_free);
828 struct hid_device *hid = parser->device;
831 hid->group = HID_GROUP_MULTITOUCH;
847 struct hid_device *hid = parser->device;
853 hid->group = HID_GROUP_SENSOR_HUB;
855 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
856 hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
857 hid->group == HID_GROUP_MULTITOUCH)
858 hid->group = HID_GROUP_GENERIC;
892 /* ignore constant inputs, they will be ignored by hid-input */
917 static int hid_scan_report(struct hid_device *hid)
921 const __u8 *start = hid->dev_rdesc;
922 const __u8 *end = start + hid->dev_rsize;
935 parser->device = hid;
936 hid->group = HID_GROUP_GENERIC;
940 * be robust against hid errors. Those errors will be raised by
950 (hid->group == HID_GROUP_MULTITOUCH))
951 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
956 switch (hid->vendor) {
958 hid->group = HID_GROUP_WACOM;
961 if (hid->group == HID_GROUP_GENERIC)
965 * hid-rmi should take care of them,
966 * not hid-generic
968 hid->group = HID_GROUP_RMI;
980 * @hid: hid device
987 int hid_parse_report(struct hid_device *hid, const __u8 *start, unsigned size)
989 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
990 if (!hid->dev_rdesc)
992 hid->dev_rsize = size;
1005 * @hid: hid device
1014 struct hid_report *hid_validate_values(struct hid_device *hid,
1022 hid_err(hid, "invalid HID report type %u\n", type);
1027 hid_err(hid, "invalid HID report id %u\n", id);
1042 &hid->report_enum[type].report_list,
1045 report = hid->report_enum[type].report_id_hash[id];
1048 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
1052 hid_err(hid, "not enough fields in %s %u\n",
1057 hid_err(hid, "not enough values in %s %u field %u\n",
1065 static int hid_calculate_multiplier(struct hid_device *hid,
1090 hid_warn(hid,
1097 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m);
1104 static void hid_apply_multiplier_to_field(struct hid_device *hid,
1122 collection = &hid->collection[usage->collection_index];
1125 collection = &hid->collection[collection->parent_idx];
1134 static void hid_apply_multiplier(struct hid_device *hid,
1162 multiplier_collection = &hid->collection[multiplier->usage->collection_index];
1165 multiplier_collection = &hid->collection[multiplier_collection->parent_idx];
1169 effective_multiplier = hid_calculate_multiplier(hid, multiplier);
1171 rep_enum = &hid->report_enum[HID_INPUT_REPORT];
1175 hid_apply_multiplier_to_field(hid, field,
1185 * @device: hid device
1205 void hid_setup_resolution_multiplier(struct hid_device *hid)
1212 rep_enum = &hid->report_enum[HID_FEATURE_REPORT];
1221 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER)
1222 hid_apply_multiplier(hid,
1233 * @device: hid device
1375 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1399 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1403 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1445 static void implement(const struct hid_device *hid, u8 *report,
1449 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1456 hid_warn(hid,
1482 * @hid: hid device
1483 * @report: hid report to match against
1485 * compare hid->driver->report_table->report_type to report->type
1487 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1489 const struct hid_report_id *id = hid->driver->report_table;
1504 * @hid: hid device
1507 * compare hid->driver->usage_table->usage_{type,code} to
1510 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1512 const struct hid_usage_id *id = hid->driver->usage_table;
1519 id->usage_hid == usage->hid) &&
1528 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1531 struct hid_driver *hdrv = hid->driver;
1534 if (!list_empty(&hid->debug_list))
1535 hid_dump_input(hid, usage, value);
1537 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1538 ret = hdrv->event(hid, field, usage, value);
1541 hid_err(hid, "%s's event failed with %d\n",
1547 if (hid->claimed & HID_CLAIMED_INPUT)
1548 hidinput_hid_event(hid, field, usage, value);
1549 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1550 hid->hiddev_hid_event(hid, field, usage, value);
1575 static void hid_input_fetch_field(struct hid_device *hid,
1593 snto32(hid_field_extract(hid, data, offset + n * size,
1595 hid_field_extract(hid, data, offset + n * size, size);
1600 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) {
1611 static void hid_input_var_field(struct hid_device *hid,
1620 hid_process_event(hid,
1634 static void hid_input_array_field(struct hid_device *hid,
1652 hid_process_event(hid,
1660 hid_process_event(hid,
1675 static void hid_process_report(struct hid_device *hid,
1686 hid_input_fetch_field(hid, report->field[a], data);
1696 hid_process_event(hid,
1702 hid_input_array_field(hid, field, interrupt);
1719 hid_input_var_field(hid, field, interrupt);
1721 hid_input_array_field(hid, field, interrupt);
1733 static void __hid_insert_field_entry(struct hid_device *hid,
1763 static void hid_report_process_ordering(struct hid_device *hid,
1801 __hid_insert_field_entry(hid, report,
1807 __hid_insert_field_entry(hid, report, &entries[usages],
1814 static void hid_process_ordering(struct hid_device *hid)
1817 struct hid_report_enum *report_enum = &hid->report_enum[HID_INPUT_REPORT];
1820 hid_report_process_ordering(hid, report);
1827 static void hid_output_field(const struct hid_device *hid,
1837 implement(hid, data, offset + n * size, size,
1840 implement(hid, data, offset + n * size, size,
1938 if (field->usage[j].hid == usage)
1967 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1969 int __hid_request(struct hid_device *hid, struct hid_report *report,
1985 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1993 hid_input_report(hid, report->type, buf, ret, 0);
2003 int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
2006 struct hid_report_enum *report_enum = hid->report_enum + type;
2025 if (hid->ll_driver->max_buffer_size)
2026 max_buffer_size = hid->ll_driver->max_buffer_size;
2039 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
2040 hid->hiddev_report_event(hid, report);
2041 if (hid->claimed & HID_CLAIMED_HIDRAW) {
2042 ret = hidraw_report_event(hid, data, size);
2047 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
2048 hid_process_report(hid, report, cdata, interrupt);
2049 hdrv = hid->driver;
2051 hdrv->report(hid, report);
2054 if (hid->claimed & HID_CLAIMED_INPUT)
2055 hidinput_report_event(hid, report);
2062 static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
2071 if (!hid)
2074 ret = down_trylock(&hid->driver_input_lock);
2076 up(&hid->driver_input_lock);
2082 if (!hid->driver) {
2086 report_enum = hid->report_enum + type;
2087 hdrv = hid->driver;
2089 data = dispatch_hid_bpf_device_event(hid, type, data, &size, interrupt, source, from_bpf);
2102 if (!list_empty(&hid->debug_list))
2103 hid_dump_report(hid, type, data, size);
2112 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
2113 ret = hdrv->raw_event(hid, report, data, size);
2118 ret = hid_report_raw_event(hid, type, data, size, interrupt);
2122 up(&hid->driver_input_lock);
2129 * @hid: hid device
2137 int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
2140 return __hid_input_report(hid, type, data, size, interrupt, 0,
2334 * @hdev: hid device
2363 * @hdev: hid device
2377 * @hdev: hid device
2405 * @hdev: hid device
2423 * @hdev: hid device
2425 * @reqtype: hid request type
2464 * @hdev: hid device
2508 * @hdev: hid device
2560 * Adds a new dynamic hid device ID to this driver,
2643 * @hdev_a: hid device
2644 * @hdev_b: hid device
2676 * hid-generic implements .match(), so we must be dealing with a
2789 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2825 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2833 .name = "hid",
2907 * hid_allocate_device - allocate new hid device descriptor
2909 * Allocate and initialize hid device, so that hid_destroy_device might be
2967 * @hdev: hid device
3043 int hid_check_keys_pressed(struct hid_device *hid)
3048 if (!(hid->claimed & HID_CLAIMED_INPUT))
3051 list_for_each_entry(hidinput, &hid->inputs, list) {
3078 pr_err("can't register hid bus\n");