Lines Matching defs:hid
31 #include <linux/hid.h>
33 #include <linux/hid-debug.h>
36 #include "hid-ids.h"
316 field->usage[i].hid = parser->local.usage[j];
703 struct hid_device *hid = to_hid_device(dev);
705 hid_close_report(hid);
706 kfree(hid->dev_rdesc);
707 kfree(hid);
779 struct hid_device *hid = parser->device;
782 hid->group = HID_GROUP_MULTITOUCH;
798 struct hid_device *hid = parser->device;
803 hid->group = HID_GROUP_SENSOR_HUB;
805 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
806 hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
807 hid->group == HID_GROUP_MULTITOUCH)
808 hid->group = HID_GROUP_GENERIC;
842 /* ignore constant inputs, they will be ignored by hid-input */
867 static int hid_scan_report(struct hid_device *hid)
871 __u8 *start = hid->dev_rdesc;
872 __u8 *end = start + hid->dev_rsize;
885 parser->device = hid;
886 hid->group = HID_GROUP_GENERIC;
890 * be robust against hid errors. Those errors will be raised by
900 (hid->group == HID_GROUP_MULTITOUCH))
901 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
906 switch (hid->vendor) {
908 hid->group = HID_GROUP_WACOM;
911 if (hid->group == HID_GROUP_GENERIC)
915 * hid-rmi should take care of them,
916 * not hid-generic
918 hid->group = HID_GROUP_RMI;
930 * @hid: hid device
937 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
939 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
940 if (!hid->dev_rdesc)
942 hid->dev_rsize = size;
955 * @hid: hid device
964 struct hid_report *hid_validate_values(struct hid_device *hid,
972 hid_err(hid, "invalid HID report type %u\n", type);
977 hid_err(hid, "invalid HID report id %u\n", id);
992 hid->report_enum[type].report_list.next,
995 report = hid->report_enum[type].report_id_hash[id];
998 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
1002 hid_err(hid, "not enough fields in %s %u\n",
1007 hid_err(hid, "not enough values in %s %u field %u\n",
1015 static int hid_calculate_multiplier(struct hid_device *hid,
1040 hid_warn(hid,
1047 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m);
1054 static void hid_apply_multiplier_to_field(struct hid_device *hid,
1072 collection = &hid->collection[usage->collection_index];
1075 collection = &hid->collection[collection->parent_idx];
1084 static void hid_apply_multiplier(struct hid_device *hid,
1112 multiplier_collection = &hid->collection[multiplier->usage->collection_index];
1115 multiplier_collection = &hid->collection[multiplier_collection->parent_idx];
1117 effective_multiplier = hid_calculate_multiplier(hid, multiplier);
1119 rep_enum = &hid->report_enum[HID_INPUT_REPORT];
1123 hid_apply_multiplier_to_field(hid, field,
1133 * @device: hid device
1153 void hid_setup_resolution_multiplier(struct hid_device *hid)
1160 rep_enum = &hid->report_enum[HID_FEATURE_REPORT];
1169 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER)
1170 hid_apply_multiplier(hid,
1181 * @device: hid device
1345 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1369 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1373 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1415 static void implement(const struct hid_device *hid, u8 *report,
1419 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1426 hid_warn(hid,
1453 * @hid: hid device
1454 * @report: hid report to match against
1456 * compare hid->driver->report_table->report_type to report->type
1458 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1460 const struct hid_report_id *id = hid->driver->report_table;
1475 * @hid: hid device
1478 * compare hid->driver->usage_table->usage_{type,code} to
1481 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1483 const struct hid_usage_id *id = hid->driver->usage_table;
1490 id->usage_hid == usage->hid) &&
1499 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1502 struct hid_driver *hdrv = hid->driver;
1505 if (!list_empty(&hid->debug_list))
1506 hid_dump_input(hid, usage, value);
1508 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1509 ret = hdrv->event(hid, field, usage, value);
1512 hid_err(hid, "%s's event failed with %d\n",
1518 if (hid->claimed & HID_CLAIMED_INPUT)
1519 hidinput_hid_event(hid, field, usage, value);
1520 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1521 hid->hiddev_hid_event(hid, field, usage, value);
1530 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1548 snto32(hid_field_extract(hid, data, offset + n * size,
1550 hid_field_extract(hid, data, offset + n * size, size);
1556 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1563 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1569 && field->usage[field->value[n] - min].hid
1571 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1575 && field->usage[value[n] - min].hid
1577 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1589 static void hid_output_field(const struct hid_device *hid,
1599 implement(hid, data, offset + n * size, size,
1602 implement(hid, data, offset + n * size, size,
1704 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1706 int __hid_request(struct hid_device *hid, struct hid_report *report,
1722 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1730 hid_input_report(hid, report->type, buf, ret, 0);
1740 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1743 struct hid_report_enum *report_enum = hid->report_enum + type;
1773 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1774 hid->hiddev_report_event(hid, report);
1775 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1776 ret = hidraw_report_event(hid, data, size);
1781 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1783 hid_input_field(hid, report->field[a], cdata, interrupt);
1784 hdrv = hid->driver;
1786 hdrv->report(hid, report);
1789 if (hid->claimed & HID_CLAIMED_INPUT)
1790 hidinput_report_event(hid, report);
1799 * @hid: hid device
1807 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
1814 if (!hid)
1817 if (down_trylock(&hid->driver_input_lock))
1820 if (!hid->driver) {
1824 report_enum = hid->report_enum + type;
1825 hdrv = hid->driver;
1834 if (!list_empty(&hid->debug_list))
1835 hid_dump_report(hid, type, data, size);
1844 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1845 ret = hdrv->raw_event(hid, report, data, size);
1850 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1853 up(&hid->driver_input_lock);
2037 * @hdev: hid device
2066 * @hdev: hid device
2080 * @hdev: hid device
2108 * @hdev: hid device
2134 * Adds a new dynamic hid device ID to this driver,
2217 * @hdev_a: hid device
2218 * @hdev_b: hid device
2267 * hid-generic implements .match(), so if
2332 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2368 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2376 .name = "hid",
2448 * hid_allocate_device - allocate new hid device descriptor
2450 * Allocate and initialize hid device, so that hid_destroy_device might be
2497 * @hdev: hid device
2572 int hid_check_keys_pressed(struct hid_device *hid)
2577 if (!(hid->claimed & HID_CLAIMED_INPUT))
2580 list_for_each_entry(hidinput, &hid->inputs, list) {
2601 pr_err("can't register hid bus\n");