Lines Matching defs:hid
34 #include <linux/hid.h>
36 #include <linux/hid-debug.h>
39 #include "hid-ids.h"
289 field->usage[i].hid = parser->local.usage[j];
647 struct hid_device *hid = to_hid_device(dev);
649 hid_close_report(hid);
650 kfree(hid->dev_rdesc);
651 kfree(hid);
723 struct hid_device *hid = parser->device;
726 hid->group = HID_GROUP_MULTITOUCH;
738 struct hid_device *hid = parser->device;
743 hid->group = HID_GROUP_SENSOR_HUB;
745 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
746 hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
747 hid->group == HID_GROUP_MULTITOUCH)
748 hid->group = HID_GROUP_GENERIC;
773 /* ignore constant inputs, they will be ignored by hid-input */
798 static int hid_scan_report(struct hid_device *hid)
802 __u8 *start = hid->dev_rdesc;
803 __u8 *end = start + hid->dev_rsize;
816 parser->device = hid;
817 hid->group = HID_GROUP_GENERIC;
821 * be robust against hid errors. Those errors will be raised by
831 (hid->group == HID_GROUP_MULTITOUCH))
832 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
837 switch (hid->vendor) {
839 hid->group = HID_GROUP_WACOM;
842 if (hid->group == HID_GROUP_GENERIC)
846 * hid-rmi should take care of them,
847 * not hid-generic
849 hid->group = HID_GROUP_RMI;
861 * @device: hid device
868 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
870 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
871 if (!hid->dev_rdesc)
873 hid->dev_rsize = size;
886 * @device: hid device
895 struct hid_report *hid_validate_values(struct hid_device *hid,
903 hid_err(hid, "invalid HID report type %u\n", type);
908 hid_err(hid, "invalid HID report id %u\n", id);
923 hid->report_enum[type].report_list.next,
926 report = hid->report_enum[type].report_id_hash[id];
929 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
933 hid_err(hid, "not enough fields in %s %u\n",
938 hid_err(hid, "not enough values in %s %u field %u\n",
949 * @device: hid device
1102 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1126 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1130 hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
1172 static void implement(const struct hid_device *hid, u8 *report,
1176 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1183 hid_warn(hid,
1210 * @hid: hid device
1213 * compare hid->driver->report_table->report_type to report->type
1215 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1217 const struct hid_report_id *id = hid->driver->report_table;
1232 * @hid: hid device
1235 * compare hid->driver->usage_table->usage_{type,code} to
1238 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1240 const struct hid_usage_id *id = hid->driver->usage_table;
1247 id->usage_hid == usage->hid) &&
1256 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1259 struct hid_driver *hdrv = hid->driver;
1262 if (!list_empty(&hid->debug_list))
1263 hid_dump_input(hid, usage, value);
1265 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1266 ret = hdrv->event(hid, field, usage, value);
1269 hid_err(hid, "%s's event failed with %d\n",
1275 if (hid->claimed & HID_CLAIMED_INPUT)
1276 hidinput_hid_event(hid, field, usage, value);
1277 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1278 hid->hiddev_hid_event(hid, field, usage, value);
1287 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1305 snto32(hid_field_extract(hid, data, offset + n * size,
1307 hid_field_extract(hid, data, offset + n * size, size);
1313 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1320 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1326 && field->usage[field->value[n] - min].hid
1328 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1332 && field->usage[value[n] - min].hid
1334 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1346 static void hid_output_field(const struct hid_device *hid,
1356 implement(hid, data, offset + n * size, size,
1359 implement(hid, data, offset + n * size, size,
1450 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1452 void __hid_request(struct hid_device *hid, struct hid_report *report,
1468 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1476 hid_input_report(hid, report->type, buf, ret, 0);
1483 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1486 struct hid_report_enum *report_enum = hid->report_enum + type;
1514 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1515 hid->hiddev_report_event(hid, report);
1516 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1517 ret = hidraw_report_event(hid, data, size);
1522 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1524 hid_input_field(hid, report->field[a], cdata, interrupt);
1525 hdrv = hid->driver;
1527 hdrv->report(hid, report);
1530 if (hid->claimed & HID_CLAIMED_INPUT)
1531 hidinput_report_event(hid, report);
1540 * @hid: hid device
1548 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
1555 if (!hid)
1558 if (down_trylock(&hid->driver_input_lock))
1561 if (!hid->driver) {
1565 report_enum = hid->report_enum + type;
1566 hdrv = hid->driver;
1575 if (!list_empty(&hid->debug_list))
1576 hid_dump_report(hid, type, data, size);
1585 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1586 ret = hdrv->raw_event(hid, report, data, size);
1591 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1594 up(&hid->driver_input_lock);
1778 * @hdev: hid device
1807 * @hdev: hid device
1821 * @hdev: hid device
1849 * @hdev: hid device
1875 * Adds a new dynamic hid device ID to this driver,
1958 * @hdev_a: hid device
1959 * @hdev_b: hid device
2008 * hid-generic implements .match(), so if
2073 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2109 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2117 .name = "hid",
2189 * hid_allocate_device - allocate new hid device descriptor
2191 * Allocate and initialize hid device, so that hid_destroy_device might be
2238 * @hdev: hid device
2313 int hid_check_keys_pressed(struct hid_device *hid)
2318 if (!(hid->claimed & HID_CLAIMED_INPUT))
2321 list_for_each_entry(hidinput, &hid->inputs, list) {
2342 pr_err("can't register hid bus\n");