Lines Matching defs:hid

34 #include <linux/hid.h>
36 #include <linux/hid-debug.h>
39 #include "hid-ids.h"
270 field->usage[i].hid = parser->local.usage[j];
609 struct hid_device *hid = container_of(dev, struct hid_device, dev);
611 hid_close_report(hid);
612 kfree(hid->dev_rdesc);
613 kfree(hid);
685 struct hid_device *hid = parser->device;
688 hid->group = HID_GROUP_MULTITOUCH;
700 struct hid_device *hid = parser->device;
705 hid->group = HID_GROUP_SENSOR_HUB;
707 if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
708 (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
709 hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP) &&
710 hid->group == HID_GROUP_MULTITOUCH)
711 hid->group = HID_GROUP_GENERIC;
736 /* ignore constant inputs, they will be ignored by hid-input */
761 static int hid_scan_report(struct hid_device *hid)
765 __u8 *start = hid->dev_rdesc;
766 __u8 *end = start + hid->dev_rsize;
779 parser->device = hid;
780 hid->group = HID_GROUP_GENERIC;
784 * be robust against hid errors. Those errors will be raised by
794 (hid->group == HID_GROUP_MULTITOUCH))
795 hid->group = HID_GROUP_MULTITOUCH_WIN_8;
800 switch (hid->vendor) {
802 hid->group = HID_GROUP_WACOM;
805 if (hid->group == HID_GROUP_GENERIC)
809 * hid-rmi should take care of them,
810 * not hid-generic
812 hid->group = HID_GROUP_RMI;
823 * @device: hid device
830 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
832 hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
833 if (!hid->dev_rdesc)
835 hid->dev_rsize = size;
848 * @device: hid device
857 struct hid_report *hid_validate_values(struct hid_device *hid,
865 hid_err(hid, "invalid HID report type %u\n", type);
870 hid_err(hid, "invalid HID report id %u\n", id);
885 hid->report_enum[type].report_list.next,
888 report = hid->report_enum[type].report_id_hash[id];
891 hid_err(hid, "missing %s %u\n", hid_report_names[type], id);
895 hid_err(hid, "not enough fields in %s %u\n",
900 hid_err(hid, "not enough values in %s %u field %u\n",
911 * @device: hid device
1061 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
1064 static __u32 extract(const struct hid_device *hid, __u8 *report,
1070 hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n",
1088 static void implement(const struct hid_device *hid, __u8 *report,
1095 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
1099 hid_warn(hid, "%s() called with too large value %d! (%s)\n",
1129 * @hid: hid device
1132 * compare hid->driver->report_table->report_type to report->type
1134 static int hid_match_report(struct hid_device *hid, struct hid_report *report)
1136 const struct hid_report_id *id = hid->driver->report_table;
1151 * @hid: hid device
1154 * compare hid->driver->usage_table->usage_{type,code} to
1157 static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
1159 const struct hid_usage_id *id = hid->driver->usage_table;
1166 id->usage_hid == usage->hid) &&
1175 static void hid_process_event(struct hid_device *hid, struct hid_field *field,
1178 struct hid_driver *hdrv = hid->driver;
1181 if (!list_empty(&hid->debug_list))
1182 hid_dump_input(hid, usage, value);
1184 if (hdrv && hdrv->event && hid_match_usage(hid, usage)) {
1185 ret = hdrv->event(hid, field, usage, value);
1188 hid_err(hid, "%s's event failed with %d\n",
1194 if (hid->claimed & HID_CLAIMED_INPUT)
1195 hidinput_hid_event(hid, field, usage, value);
1196 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
1197 hid->hiddev_hid_event(hid, field, usage, value);
1206 static void hid_input_field(struct hid_device *hid, struct hid_field *field,
1224 snto32(extract(hid, data, offset + n * size, size),
1226 extract(hid, data, offset + n * size, size);
1231 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
1238 hid_process_event(hid, field, &field->usage[n], value[n], interrupt);
1243 && field->usage[field->value[n] - min].hid
1245 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);
1248 && field->usage[value[n] - min].hid
1250 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);
1262 static void hid_output_field(const struct hid_device *hid,
1272 implement(hid, data, offset + n * size, size,
1275 implement(hid, data, offset + n * size, size,
1366 * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
1368 void __hid_request(struct hid_device *hid, struct hid_report *report,
1384 ret = hid->ll_driver->raw_request(hid, report->id, buf, len,
1392 hid_input_report(hid, report->type, buf, ret, 0);
1399 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1402 struct hid_report_enum *report_enum = hid->report_enum + type;
1430 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1431 hid->hiddev_report_event(hid, report);
1432 if (hid->claimed & HID_CLAIMED_HIDRAW) {
1433 ret = hidraw_report_event(hid, data, size);
1438 if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
1440 hid_input_field(hid, report->field[a], cdata, interrupt);
1441 hdrv = hid->driver;
1443 hdrv->report(hid, report);
1446 if (hid->claimed & HID_CLAIMED_INPUT)
1447 hidinput_report_event(hid, report);
1456 * @hid: hid device
1464 int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
1471 if (!hid)
1474 if (down_trylock(&hid->driver_input_lock))
1477 if (!hid->driver) {
1481 report_enum = hid->report_enum + type;
1482 hdrv = hid->driver;
1491 if (!list_empty(&hid->debug_list))
1492 hid_dump_report(hid, type, data, size);
1501 if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
1502 ret = hdrv->raw_event(hid, report, data, size);
1507 ret = hid_report_raw_event(hid, type, data, size, interrupt);
1510 up(&hid->driver_input_lock);
1698 * Please note that for multitouch devices (driven by hid-multitouch driver),
1704 * physical is found inside a usage page of type sensor, hid-sensor-hub will be
2031 * Adds a new dynamic hid device ID to this driver,
2186 len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2216 if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X",
2224 .name = "hid",
2416 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
2499 * the Logitech AudioHub Speaker, but it should ignore the hid.
2535 * ignore the hid. Check the name, bus, product and ignore
2613 * hid_allocate_device - allocate new hid device descriptor
2615 * Allocate and initialize hid device, so that hid_destroy_device might be
2661 * @hdev: hid device
2706 int hid_check_keys_pressed(struct hid_device *hid)
2711 if (!(hid->claimed & HID_CLAIMED_INPUT))
2714 list_for_each_entry(hidinput, &hid->inputs, list) {
2735 pr_err("can't register hid bus\n");