Lines Matching refs:hid

31 #include <linux/hid.h>
33 #include <linux/hid-debug.h>
36 #include "hid-ids.h"
318 field->usage[i].hid = parser->local.usage[j];
707 struct hid_device *hid = container_of(ref, struct hid_device, ref);
709 hid_close_report(hid);
710 kfree(hid->dev_rdesc);
711 kfree(hid);
716 struct hid_device *hid = to_hid_device(dev);
718 kref_put(&hid->ref, hiddev_free);
790 struct hid_device *hid = parser->device;
793 hid->group = HID_GROUP_MULTITOUCH;
809 struct hid_device *hid = parser->device;
815 hid->group = HID_GROUP_SENSOR_HUB;
817 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
818 hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
819 hid->group == HID_GROUP_MULTITOUCH)
820 hid->group = HID_GROUP_GENERIC;
854 /* ignore constant inputs, they will be ignored by hid-input */
879 static int hid_scan_report(struct hid_device *hid)
883 __u8 *start = hid->dev_rdesc;
884 __u8 *end = start + hid->dev_rsize;
897 parser->device = hid;
898 hid->group = HID_GROUP_GENERIC;
902 * be robust against hid errors. Those errors will be raised by
912 (hid->group == HID_GROUP_MULTITOUCH))
913 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
918 switch (hid->vendor) {
920 hid->group = HID_GROUP_WACOM;
923 if (hid->group == HID_GROUP_GENERIC)
927 * hid-rmi should take care of them,
928 * not hid-generic
930 hid->group = HID_GROUP_RMI;
942 * @hid: hid device
949 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
951 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
952 if (!hid->dev_rdesc)
954 hid->dev_rsize = size;
967 * @hid: hid device
976 struct hid_report *hid_validate_values(struct hid_device *hid,
984 hid_err(hid, "invalid HID report type %u\n", type);
989 hid_err(hid, "invalid HID report id %u\n", id);
1004 &hid->report_enum[type].report_list,
1007 report = hid->report_enum[type].report_id_hash[id];
1010 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
1014 hid_err(hid, "not enough fields in %s %u\n",
1019 hid_err(hid, "not enough values in %s %u field %u\n",
1027 static int hid_calculate_multiplier(struct hid_device *hid,
1052 hid_warn(hid,
1059 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m);
1066 static void hid_apply_multiplier_to_field(struct hid_device *hid,
1084 collection = &hid->collection[usage->collection_index];
1087 collection = &hid->collection[collection->parent_idx];
1096 static void hid_apply_multiplier(struct hid_device *hid,
1124 multiplier_collection = &hid->collection[multiplier->usage->collection_index];
1127 multiplier_collection = &hid->collection[multiplier_collection->parent_idx];
1129 effective_multiplier = hid_calculate_multiplier(hid, multiplier);
1131 rep_enum = &hid->report_enum[HID_INPUT_REPORT];
1135 hid_apply_multiplier_to_field(hid, field,
1145 * @device: hid device
1165 void hid_setup_resolution_multiplier(struct hid_device *hid)
1172 rep_enum = &hid->report_enum[HID_FEATURE_REPORT];
1181 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER)
1182 hid_apply_multiplier(hid,
1193 * @device: hid device
1367 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1391 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1395 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1437 static void implement(const struct hid_device *hid, u8 *report,
1441 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1448 hid_warn(hid,
1475 * @hid: hid device
1476 * @report: hid report to match against
1478 * compare hid->driver->report_table->report_type to report->type
1480 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1482 const struct hid_report_id *id = hid->driver->report_table;
1497 * @hid: hid device
1500 * compare hid->driver->usage_table->usage_{type,code} to
1503 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1505 const struct hid_usage_id *id = hid->driver->usage_table;
1512 id->usage_hid == usage->hid) &&
1521 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1524 struct hid_driver *hdrv = hid->driver;
1527 if (!list_empty(&hid->debug_list))
1528 hid_dump_input(hid, usage, value);
1530 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1531 ret = hdrv->event(hid, field, usage, value);
1534 hid_err(hid, "%s's event failed with %d\n",
1540 if (hid->claimed & HID_CLAIMED_INPUT)
1541 hidinput_hid_event(hid, field, usage, value);
1542 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1543 hid->hiddev_hid_event(hid, field, usage, value);
1568 static void hid_input_fetch_field(struct hid_device *hid,
1586 snto32(hid_field_extract(hid, data, offset + n * size,
1588 hid_field_extract(hid, data, offset + n * size, size);
1593 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) {
1604 static void hid_input_var_field(struct hid_device *hid,
1613 hid_process_event(hid,
1627 static void hid_input_array_field(struct hid_device *hid,
1645 hid_process_event(hid,
1653 hid_process_event(hid,
1668 static void hid_process_report(struct hid_device *hid,
1679 hid_input_fetch_field(hid, report->field[a], data);
1689 hid_process_event(hid,
1695 hid_input_array_field(hid, field, interrupt);
1712 hid_input_var_field(hid, field, interrupt);
1714 hid_input_array_field(hid, field, interrupt);
1726 static void __hid_insert_field_entry(struct hid_device *hid,
1756 static void hid_report_process_ordering(struct hid_device *hid,
1794 __hid_insert_field_entry(hid, report,
1800 __hid_insert_field_entry(hid, report, &entries[usages],
1807 static void hid_process_ordering(struct hid_device *hid)
1810 struct hid_report_enum *report_enum = &hid->report_enum[HID_INPUT_REPORT];
1813 hid_report_process_ordering(hid, report);
1820 static void hid_output_field(const struct hid_device *hid,
1830 implement(hid, data, offset + n * size, size,
1833 implement(hid, data, offset + n * size, size,
1935 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1937 int __hid_request(struct hid_device *hid, struct hid_report *report,
1953 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1961 hid_input_report(hid, report->type, buf, ret, 0);
1971 int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
1974 struct hid_report_enum *report_enum = hid->report_enum + type;
1993 if (hid->ll_driver->max_buffer_size)
1994 max_buffer_size = hid->ll_driver->max_buffer_size;
2007 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
2008 hid->hiddev_report_event(hid, report);
2009 if (hid->claimed & HID_CLAIMED_HIDRAW) {
2010 ret = hidraw_report_event(hid, data, size);
2015 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
2016 hid_process_report(hid, report, cdata, interrupt);
2017 hdrv = hid->driver;
2019 hdrv->report(hid, report);
2022 if (hid->claimed & HID_CLAIMED_INPUT)
2023 hidinput_report_event(hid, report);
2032 * @hid: hid device
2040 int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
2048 if (!hid)
2051 if (down_trylock(&hid->driver_input_lock))
2054 if (!hid->driver) {
2058 report_enum = hid->report_enum + type;
2059 hdrv = hid->driver;
2061 data = dispatch_hid_bpf_device_event(hid, type, data, &size, interrupt);
2074 if (!list_empty(&hid->debug_list))
2075 hid_dump_report(hid, type, data, size);
2084 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
2085 ret = hdrv->raw_event(hid, report, data, size);
2090 ret = hid_report_raw_event(hid, type, data, size, interrupt);
2093 up(&hid->driver_input_lock);
2293 * @hdev: hid device
2322 * @hdev: hid device
2336 * @hdev: hid device
2364 * @hdev: hid device
2382 * @hdev: hid device
2384 * @reqtype: hid request type
2399 * @hdev: hid device
2430 * @hdev: hid device
2493 * Adds a new dynamic hid device ID to this driver,
2576 * @hdev_a: hid device
2577 * @hdev_b: hid device
2609 * hid-generic implements .match(), so we must be dealing with a
2709 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2745 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2753 .name = "hid",
2827 * hid_allocate_device - allocate new hid device descriptor
2829 * Allocate and initialize hid device, so that hid_destroy_device might be
2879 * @hdev: hid device
2955 int hid_check_keys_pressed(struct hid_device *hid)
2960 if (!(hid->claimed & HID_CLAIMED_INPUT))
2963 list_for_each_entry(hidinput, &hid->inputs, list) {
2990 pr_err("can't register hid bus\n");