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
1348 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1372 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1376 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1418 static void implement(const struct hid_device *hid, u8 *report,
1422 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1429 hid_warn(hid,
1456 * @hid: hid device
1457 * @report: hid report to match against
1459 * compare hid->driver->report_table->report_type to report->type
1461 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1463 const struct hid_report_id *id = hid->driver->report_table;
1478 * @hid: hid device
1481 * compare hid->driver->usage_table->usage_{type,code} to
1484 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1486 const struct hid_usage_id *id = hid->driver->usage_table;
1493 id->usage_hid == usage->hid) &&
1502 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1505 struct hid_driver *hdrv = hid->driver;
1508 if (!list_empty(&hid->debug_list))
1509 hid_dump_input(hid, usage, value);
1511 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1512 ret = hdrv->event(hid, field, usage, value);
1515 hid_err(hid, "%s's event failed with %d\n",
1521 if (hid->claimed & HID_CLAIMED_INPUT)
1522 hidinput_hid_event(hid, field, usage, value);
1523 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1524 hid->hiddev_hid_event(hid, field, usage, value);
1533 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1551 snto32(hid_field_extract(hid, data, offset + n * size,
1553 hid_field_extract(hid, data, offset + n * size, size);
1559 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1566 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1572 && field->usage[field->value[n] - min].hid
1574 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1578 && field->usage[value[n] - min].hid
1580 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1592 static void hid_output_field(const struct hid_device *hid,
1602 implement(hid, data, offset + n * size, size,
1605 implement(hid, data, offset + n * size, size,
1707 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1709 int __hid_request(struct hid_device *hid, struct hid_report *report,
1725 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1733 hid_input_report(hid, report->type, buf, ret, 0);
1743 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1746 struct hid_report_enum *report_enum = hid->report_enum + type;
1776 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1777 hid->hiddev_report_event(hid, report);
1778 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1779 ret = hidraw_report_event(hid, data, size);
1784 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1786 hid_input_field(hid, report->field[a], cdata, interrupt);
1787 hdrv = hid->driver;
1789 hdrv->report(hid, report);
1792 if (hid->claimed & HID_CLAIMED_INPUT)
1793 hidinput_report_event(hid, report);
1802 * @hid: hid device
1810 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
1817 if (!hid)
1820 if (down_trylock(&hid->driver_input_lock))
1823 if (!hid->driver) {
1827 report_enum = hid->report_enum + type;
1828 hdrv = hid->driver;
1837 if (!list_empty(&hid->debug_list))
1838 hid_dump_report(hid, type, data, size);
1847 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1848 ret = hdrv->raw_event(hid, report, data, size);
1853 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1856 up(&hid->driver_input_lock);
2043 * @hdev: hid device
2072 * @hdev: hid device
2086 * @hdev: hid device
2114 * @hdev: hid device
2140 * Adds a new dynamic hid device ID to this driver,
2223 * @hdev_a: hid device
2224 * @hdev_b: hid device
2273 * 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) {
2600 pr_err("can't register hid bus\n");