Lines Matching defs:hid

31 #include <linux/hid.h>
33 #include <linux/hid-debug.h>
36 #include "hid-ids.h"
290 field->usage[i].hid = parser->local.usage[j];
658 struct hid_device *hid = to_hid_device(dev);
660 hid_close_report(hid);
661 kfree(hid->dev_rdesc);
662 kfree(hid);
734 struct hid_device *hid = parser->device;
737 hid->group = HID_GROUP_MULTITOUCH;
749 struct hid_device *hid = parser->device;
754 hid->group = HID_GROUP_SENSOR_HUB;
756 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
757 hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
758 hid->group == HID_GROUP_MULTITOUCH)
759 hid->group = HID_GROUP_GENERIC;
786 /* ignore constant inputs, they will be ignored by hid-input */
811 static int hid_scan_report(struct hid_device *hid)
815 __u8 *start = hid->dev_rdesc;
816 __u8 *end = start + hid->dev_rsize;
829 parser->device = hid;
830 hid->group = HID_GROUP_GENERIC;
834 * be robust against hid errors. Those errors will be raised by
844 (hid->group == HID_GROUP_MULTITOUCH))
845 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
850 switch (hid->vendor) {
852 hid->group = HID_GROUP_WACOM;
855 if (hid->group == HID_GROUP_GENERIC)
859 * hid-rmi should take care of them,
860 * not hid-generic
862 hid->group = HID_GROUP_RMI;
874 * @device: hid device
881 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
883 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
884 if (!hid->dev_rdesc)
886 hid->dev_rsize = size;
899 * @device: hid device
908 struct hid_report *hid_validate_values(struct hid_device *hid,
916 hid_err(hid, "invalid HID report type %u\n", type);
921 hid_err(hid, "invalid HID report id %u\n", id);
936 hid->report_enum[type].report_list.next,
939 report = hid->report_enum[type].report_id_hash[id];
942 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
946 hid_err(hid, "not enough fields in %s %u\n",
951 hid_err(hid, "not enough values in %s %u field %u\n",
959 static int hid_calculate_multiplier(struct hid_device *hid,
984 hid_warn(hid,
991 hid_warn(hid, "unsupported Resolution Multiplier %d\n", m);
998 static void hid_apply_multiplier_to_field(struct hid_device *hid,
1016 collection = &hid->collection[usage->collection_index];
1019 collection = &hid->collection[collection->parent_idx];
1028 static void hid_apply_multiplier(struct hid_device *hid,
1056 multiplier_collection = &hid->collection[multiplier->usage->collection_index];
1059 multiplier_collection = &hid->collection[multiplier_collection->parent_idx];
1061 effective_multiplier = hid_calculate_multiplier(hid, multiplier);
1063 rep_enum = &hid->report_enum[HID_INPUT_REPORT];
1067 hid_apply_multiplier_to_field(hid, field,
1077 * @device: hid device
1097 void hid_setup_resolution_multiplier(struct hid_device *hid)
1104 rep_enum = &hid->report_enum[HID_FEATURE_REPORT];
1113 if (usage->hid == HID_GD_RESOLUTION_MULTIPLIER)
1114 hid_apply_multiplier(hid,
1125 * @device: hid device
1289 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1313 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1317 hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n",
1359 static void implement(const struct hid_device *hid, u8 *report,
1363 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1370 hid_warn(hid,
1397 * @hid: hid device
1400 * compare hid->driver->report_table->report_type to report->type
1402 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1404 const struct hid_report_id *id = hid->driver->report_table;
1419 * @hid: hid device
1422 * compare hid->driver->usage_table->usage_{type,code} to
1425 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1427 const struct hid_usage_id *id = hid->driver->usage_table;
1434 id->usage_hid == usage->hid) &&
1443 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1446 struct hid_driver *hdrv = hid->driver;
1449 if (!list_empty(&hid->debug_list))
1450 hid_dump_input(hid, usage, value);
1452 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1453 ret = hdrv->event(hid, field, usage, value);
1456 hid_err(hid, "%s's event failed with %d\n",
1462 if (hid->claimed & HID_CLAIMED_INPUT)
1463 hidinput_hid_event(hid, field, usage, value);
1464 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1465 hid->hiddev_hid_event(hid, field, usage, value);
1474 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1492 snto32(hid_field_extract(hid, data, offset + n * size,
1494 hid_field_extract(hid, data, offset + n * size, size);
1500 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1507 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1513 && field->usage[field->value[n] - min].hid
1515 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1519 && field->usage[value[n] - min].hid
1521 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1533 static void hid_output_field(const struct hid_device *hid,
1543 implement(hid, data, offset + n * size, size,
1546 implement(hid, data, offset + n * size, size,
1637 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1639 int __hid_request(struct hid_device *hid, struct hid_report *report,
1655 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1663 hid_input_report(hid, report->type, buf, ret, 0);
1673 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1676 struct hid_report_enum *report_enum = hid->report_enum + type;
1704 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1705 hid->hiddev_report_event(hid, report);
1706 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1707 ret = hidraw_report_event(hid, data, size);
1712 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1714 hid_input_field(hid, report->field[a], cdata, interrupt);
1715 hdrv = hid->driver;
1717 hdrv->report(hid, report);
1720 if (hid->claimed & HID_CLAIMED_INPUT)
1721 hidinput_report_event(hid, report);
1730 * @hid: hid device
1738 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
1745 if (!hid)
1748 if (down_trylock(&hid->driver_input_lock))
1751 if (!hid->driver) {
1755 report_enum = hid->report_enum + type;
1756 hdrv = hid->driver;
1765 if (!list_empty(&hid->debug_list))
1766 hid_dump_report(hid, type, data, size);
1775 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1776 ret = hdrv->raw_event(hid, report, data, size);
1781 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1784 up(&hid->driver_input_lock);
1968 * @hdev: hid device
1997 * @hdev: hid device
2011 * @hdev: hid device
2039 * @hdev: hid device
2065 * Adds a new dynamic hid device ID to this driver,
2148 * @hdev_a: hid device
2149 * @hdev_b: hid device
2198 * hid-generic implements .match(), so if
2263 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2299 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2307 .name = "hid",
2379 * hid_allocate_device - allocate new hid device descriptor
2381 * Allocate and initialize hid device, so that hid_destroy_device might be
2428 * @hdev: hid device
2503 int hid_check_keys_pressed(struct hid_device *hid)
2508 if (!(hid->claimed & HID_CLAIMED_INPUT))
2511 list_for_each_entry(hidinput, &hid->inputs, list) {
2532 pr_err("can't register hid bus\n");