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
1351 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1375 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1379 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1421 static void implement(const struct hid_device *hid, u8 *report,
1425 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1432 hid_warn(hid,
1459 * @hid: hid device
1460 * @report: hid report to match against
1462 * compare hid->driver->report_table->report_type to report->type
1464 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1466 const struct hid_report_id *id = hid->driver->report_table;
1481 * @hid: hid device
1484 * compare hid->driver->usage_table->usage_{type,code} to
1487 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1489 const struct hid_usage_id *id = hid->driver->usage_table;
1496 id->usage_hid == usage->hid) &&
1505 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1508 struct hid_driver *hdrv = hid->driver;
1511 if (!list_empty(&hid->debug_list))
1512 hid_dump_input(hid, usage, value);
1514 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1515 ret = hdrv->event(hid, field, usage, value);
1518 hid_err(hid, "%s's event failed with %d\n",
1524 if (hid->claimed & HID_CLAIMED_INPUT)
1525 hidinput_hid_event(hid, field, usage, value);
1526 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1527 hid->hiddev_hid_event(hid, field, usage, value);
1536 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1554 snto32(hid_field_extract(hid, data, offset + n * size,
1556 hid_field_extract(hid, data, offset + n * size, size);
1562 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1569 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1575 && field->usage[field->value[n] - min].hid
1577 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1581 && field->usage[value[n] - min].hid
1583 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1595 static void hid_output_field(const struct hid_device *hid,
1605 implement(hid, data, offset + n * size, size,
1608 implement(hid, data, offset + n * size, size,
1710 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1712 int __hid_request(struct hid_device *hid, struct hid_report *report,
1728 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1736 hid_input_report(hid, report->type, buf, ret, 0);
1746 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1749 struct hid_report_enum *report_enum = hid->report_enum + type;
1779 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1780 hid->hiddev_report_event(hid, report);
1781 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1782 ret = hidraw_report_event(hid, data, size);
1787 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1789 hid_input_field(hid, report->field[a], cdata, interrupt);
1790 hdrv = hid->driver;
1792 hdrv->report(hid, report);
1795 if (hid->claimed & HID_CLAIMED_INPUT)
1796 hidinput_report_event(hid, report);
1805 * @hid: hid device
1813 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
1820 if (!hid)
1823 if (down_trylock(&hid->driver_input_lock))
1826 if (!hid->driver) {
1830 report_enum = hid->report_enum + type;
1831 hdrv = hid->driver;
1840 if (!list_empty(&hid->debug_list))
1841 hid_dump_report(hid, type, data, size);
1850 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1851 ret = hdrv->raw_event(hid, report, data, size);
1856 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1859 up(&hid->driver_input_lock);
2046 * @hdev: hid device
2075 * @hdev: hid device
2089 * @hdev: hid device
2117 * @hdev: hid device
2143 * Adds a new dynamic hid device ID to this driver,
2226 * @hdev_a: hid device
2227 * @hdev_b: hid device
2276 * hid-generic implements .match(), so if
2337 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2373 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2381 .name = "hid",
2453 * hid_allocate_device - allocate new hid device descriptor
2455 * Allocate and initialize hid device, so that hid_destroy_device might be
2502 * @hdev: hid device
2577 int hid_check_keys_pressed(struct hid_device *hid)
2582 if (!(hid->claimed & HID_CLAIMED_INPUT))
2585 list_for_each_entry(hidinput, &hid->inputs, list) {
2606 pr_err("can't register hid bus\n");