Lines Matching defs:hdev
240 static int __hidpp_send_report(struct hid_device *hdev,
243 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
267 ret = hid_hw_output_report(hdev, (u8 *)hidpp_report, fields_count);
269 ret = hid_hw_raw_request(hdev, hidpp_report->report_id,
518 struct hid_device *hdev = hidpp->hid_dev;
523 if (!hid_is_usb(hdev))
526 intf = to_usb_interface(hdev->dev.parent);
905 struct hid_device *hdev = hidpp->hid_dev;
914 snprintf(hdev->uniq, sizeof(hdev->uniq), "%4phD", &serial);
915 dbg_hid("HID++ Unifying: Got serial: %s\n", hdev->uniq);
921 snprintf(hdev->name, sizeof(hdev->name), "%s", name);
1041 struct hid_device *hdev = hidpp->hid_dev;
1049 snprintf(hdev->uniq, sizeof(hdev->uniq), "%4phD", &serial);
1050 dbg_hid("HID++ DeviceInformation: Got serial: %s\n", hdev->uniq);
2938 static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3057 static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size)
3059 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3070 hid_err(hdev, "Received HID report of bad size (%d)",
3129 static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id)
3131 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3134 wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data),
3144 static int wtp_connect(struct hid_device *hdev, bool connected)
3146 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3153 hid_err(hdev, "Can not get wtp config: %d\n", ret);
3206 static int m560_send_config_command(struct hid_device *hdev, bool connected)
3211 hidpp_dev = hid_get_drvdata(hdev);
3224 static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
3226 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3230 hid_err(hdev, "error in parameter\n");
3235 hid_err(hdev, "error in report\n");
3270 hid_err(hdev, "error in report\n");
3302 v = hid_snto32(hid_field_extract(hdev, data+3, 0, 12), 12);
3305 v = hid_snto32(hid_field_extract(hdev, data+3, 12, 12), 12);
3338 static int m560_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3386 static int k400_allocate(struct hid_device *hdev)
3388 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3391 k400 = devm_kzalloc(&hdev->dev, sizeof(struct k400_private_data),
3401 static int k400_connect(struct hid_device *hdev, bool connected)
3403 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3511 static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3773 static u8 *hidpp_report_fixup(struct hid_device *hdev, u8 *rdesc,
3776 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3782 if (hdev->group == HID_GROUP_LOGITECH_27MHZ_DEVICE ||
3789 static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3793 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3799 return wtp_input_mapping(hdev, hi, field, usage, bit, max);
3802 return m560_input_mapping(hdev, hi, field, usage, bit, max);
3804 if (hdev->product == DINOVO_MINI_PRODUCT_ID)
3805 return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max);
3810 static int hidpp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
3814 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3849 static int hidpp_input_configured(struct hid_device *hdev,
3852 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3958 static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report,
3961 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3971 hid_err(hdev, "received hid++ report of bad size (%d)",
3979 hid_err(hdev, "received hid++ report of bad size (%d)",
3987 hid_err(hdev, "received hid++ report of bad size (%d)",
4001 return wtp_raw_event(hdev, data, size);
4003 return m560_raw_event(hdev, data, size);
4008 static int hidpp_event(struct hid_device *hdev, struct hid_field *field,
4014 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
4133 static void hidpp_overwrite_name(struct hid_device *hdev)
4135 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
4144 hid_err(hdev, "unable to retrieve the name of the device");
4147 snprintf(hdev->name, sizeof(hdev->name), "%s", name);
4167 static struct input_dev *hidpp_allocate_input(struct hid_device *hdev)
4169 struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev);
4170 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
4175 input_set_drvdata(input_dev, hdev);
4180 input_dev->phys = hdev->phys;
4181 input_dev->uniq = hdev->uniq;
4182 input_dev->id.bustype = hdev->bus;
4183 input_dev->id.vendor = hdev->vendor;
4184 input_dev->id.product = hdev->product;
4185 input_dev->id.version = hdev->version;
4186 input_dev->dev.parent = &hdev->dev;
4193 struct hid_device *hdev = hidpp->hid_dev;
4210 ret = wtp_connect(hdev, connected);
4214 ret = m560_send_config_command(hdev, connected);
4218 ret = k400_connect(hdev, connected);
4246 hid_err(hdev, "Can not get the protocol version.\n");
4258 if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) {
4261 devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
4302 input = hidpp_allocate_input(hdev);
4304 hid_err(hdev, "cannot allocate new input device: %d\n", ret);
4330 static int hidpp_get_report_length(struct hid_device *hdev, int id)
4335 re = &(hdev->report_enum[HID_OUTPUT_REPORT]);
4343 static u8 hidpp_validate_device(struct hid_device *hdev)
4345 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
4350 report_length = hidpp_get_report_length(hdev, id);
4359 report_length = hidpp_get_report_length(hdev, id);
4368 report_length = hidpp_get_report_length(hdev, id);
4381 hid_warn(hdev, "not enough values in hidpp report %d\n", id);
4385 static bool hidpp_application_equals(struct hid_device *hdev,
4391 report_list = &hdev->report_enum[HID_INPUT_REPORT].report_list;
4396 static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
4405 hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL);
4409 hidpp->hid_dev = hdev;
4410 hidpp->name = hdev->name;
4412 hid_set_drvdata(hdev, hidpp);
4414 ret = hid_parse(hdev);
4416 hid_err(hdev, "%s:parse failed\n", __func__);
4423 hidpp->supported_reports = hidpp_validate_device(hdev);
4426 hid_set_drvdata(hdev, NULL);
4427 devm_kfree(&hdev->dev, hidpp);
4428 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
4435 hidpp_application_equals(hdev, HID_GD_MOUSE))
4440 hidpp_application_equals(hdev, HID_GD_KEYBOARD))
4444 ret = wtp_allocate(hdev, id);
4448 ret = k400_allocate(hdev);
4458 ret = sysfs_create_group(&hdev->dev.kobj, &ps_attribute_group);
4460 hid_warn(hdev, "Cannot allocate sysfs group for %s\n",
4461 hdev->name);
4464 * First call hid_hw_start(hdev, 0) to allow IO without connecting any
4466 * name and serial number and store these in hdev->name and hdev->uniq,
4469 ret = hid_hw_start(hdev, 0);
4471 hid_err(hdev, "hw start failed\n");
4475 ret = hid_hw_open(hdev);
4477 dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n",
4483 hid_device_io_start(hdev);
4495 hid_err(hdev, "Device not connected");
4499 hidpp_overwrite_name(hdev);
4519 ret = hid_connect(hdev, connect_mask);
4521 hid_err(hdev, "%s:hid_connect returned error %d\n", __func__, ret);
4537 hid_hw_close(hdev);
4541 hid_hw_close(hdev);
4543 hid_hw_stop(hdev);
4545 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
4551 static void hidpp_remove(struct hid_device *hdev)
4553 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
4556 return hid_hw_stop(hdev);
4558 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
4560 hid_hw_stop(hdev);