Lines Matching defs:hid

34 #include <linux/hid.h>
36 #include <linux/hid-debug.h>
39 #include "hid-ids.h"
320 field->usage[i].hid = parser->local.usage[j];
706 struct hid_device *hid = to_hid_device(dev);
708 hid_close_report(hid);
709 kfree(hid->dev_rdesc);
710 kfree(hid);
782 struct hid_device *hid = parser->device;
785 hid->group = HID_GROUP_MULTITOUCH;
801 struct hid_device *hid = parser->device;
806 hid->group = HID_GROUP_SENSOR_HUB;
808 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
809 hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
810 hid->group == HID_GROUP_MULTITOUCH)
811 hid->group = HID_GROUP_GENERIC;
838 /* ignore constant inputs, they will be ignored by hid-input */
863 static int hid_scan_report(struct hid_device *hid)
867 __u8 *start = hid->dev_rdesc;
868 __u8 *end = start + hid->dev_rsize;
881 parser->device = hid;
882 hid->group = HID_GROUP_GENERIC;
886 * be robust against hid errors. Those errors will be raised by
896 (hid->group == HID_GROUP_MULTITOUCH))
897 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
902 switch (hid->vendor) {
904 hid->group = HID_GROUP_WACOM;
907 if (hid->group == HID_GROUP_GENERIC)
911 * hid-rmi should take care of them,
912 * not hid-generic
914 hid->group = HID_GROUP_RMI;
926 * @device: hid device
933 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
935 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
936 if (!hid->dev_rdesc)
938 hid->dev_rsize = size;
951 * @device: hid device
960 struct hid_report *hid_validate_values(struct hid_device *hid,
968 hid_err(hid, "invalid HID report type %u\n", type);
973 hid_err(hid, "invalid HID report id %u\n", id);
988 &hid->report_enum[type].report_list,
991 report = hid->report_enum[type].report_id_hash[id];
994 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
998 hid_err(hid, "not enough fields in %s %u\n",
1003 hid_err(hid, "not enough values in %s %u field %u\n",
1014 * @device: hid device
1176 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1200 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
1204 hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
1246 static void implement(const struct hid_device *hid, u8 *report,
1250 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1257 hid_warn(hid,
1284 * @hid: hid device
1287 * compare hid->driver->report_table->report_type to report->type
1289 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1291 const struct hid_report_id *id = hid->driver->report_table;
1306 * @hid: hid device
1309 * compare hid->driver->usage_table->usage_{type,code} to
1312 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1314 const struct hid_usage_id *id = hid->driver->usage_table;
1321 id->usage_hid == usage->hid) &&
1330 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1333 struct hid_driver *hdrv = hid->driver;
1336 if (!list_empty(&hid->debug_list))
1337 hid_dump_input(hid, usage, value);
1339 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1340 ret = hdrv->event(hid, field, usage, value);
1343 hid_err(hid, "%s's event failed with %d\n",
1349 if (hid->claimed & HID_CLAIMED_INPUT)
1350 hidinput_hid_event(hid, field, usage, value);
1351 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1352 hid->hiddev_hid_event(hid, field, usage, value);
1361 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1379 snto32(hid_field_extract(hid, data, offset + n * size,
1381 hid_field_extract(hid, data, offset + n * size, size);
1387 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1394 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1400 && field->usage[field->value[n] - min].hid
1402 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1406 && field->usage[value[n] - min].hid
1408 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1420 static void hid_output_field(const struct hid_device *hid,
1430 implement(hid, data, offset + n * size, size,
1433 implement(hid, data, offset + n * size, size,
1535 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1537 void __hid_request(struct hid_device *hid, struct hid_report *report,
1553 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1561 hid_input_report(hid, report->type, buf, ret, 0);
1568 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1571 struct hid_report_enum *report_enum = hid->report_enum + type;
1591 if (hid->ll_driver->max_buffer_size)
1592 max_buffer_size = hid->ll_driver->max_buffer_size;
1605 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1606 hid->hiddev_report_event(hid, report);
1607 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1608 ret = hidraw_report_event(hid, data, size);
1613 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1615 hid_input_field(hid, report->field[a], cdata, interrupt);
1616 hdrv = hid->driver;
1618 hdrv->report(hid, report);
1621 if (hid->claimed & HID_CLAIMED_INPUT)
1622 hidinput_report_event(hid, report);
1631 * @hid: hid device
1639 int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
1646 if (!hid)
1649 if (down_trylock(&hid->driver_input_lock))
1652 if (!hid->driver) {
1656 report_enum = hid->report_enum + type;
1657 hdrv = hid->driver;
1666 if (!list_empty(&hid->debug_list))
1667 hid_dump_report(hid, type, data, size);
1676 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1677 ret = hdrv->raw_event(hid, report, data, size);
1682 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1685 up(&hid->driver_input_lock);
1872 * @hdev: hid device
1901 * @hdev: hid device
1915 * @hdev: hid device
1943 * @hdev: hid device
1969 * Adds a new dynamic hid device ID to this driver,
2052 * @hdev_a: hid device
2053 * @hdev_b: hid device
2102 * hid-generic implements .match(), so if
2163 return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2199 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2207 .name = "hid",
2279 * hid_allocate_device - allocate new hid device descriptor
2281 * Allocate and initialize hid device, so that hid_destroy_device might be
2328 * @hdev: hid device
2403 int hid_check_keys_pressed(struct hid_device *hid)
2408 if (!(hid->claimed & HID_CLAIMED_INPUT))
2411 list_for_each_entry(hidinput, &hid->inputs, list) {
2432 pr_err("can't register hid bus\n");