Lines Matching defs:hdev

217 static int __hidpp_send_report(struct hid_device *hdev,
220 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
244 ret = hid_hw_output_report(hdev, (u8 *)hidpp_report, fields_count);
246 ret = hid_hw_raw_request(hdev, hidpp_report->report_id,
815 struct hid_device *hdev = hidpp->hid_dev;
824 snprintf(hdev->uniq, sizeof(hdev->uniq), "%4phD", &serial);
825 dbg_hid("HID++ Unifying: Got serial: %s\n", hdev->uniq);
831 snprintf(hdev->name, sizeof(hdev->name), "%s", name);
951 struct hid_device *hdev = hidpp->hid_dev;
959 snprintf(hdev->uniq, sizeof(hdev->uniq), "%4phD", &serial);
960 dbg_hid("HID++ DeviceInformation: Got serial: %s\n", hdev->uniq);
2427 static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
2546 static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size)
2548 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
2559 hid_err(hdev, "Received HID report of bad size (%d)",
2618 static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id)
2620 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
2623 wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data),
2633 static int wtp_connect(struct hid_device *hdev, bool connected)
2635 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
2642 hid_err(hdev, "Can not get wtp config: %d\n", ret);
2695 static int m560_send_config_command(struct hid_device *hdev, bool connected)
2700 hidpp_dev = hid_get_drvdata(hdev);
2713 static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
2715 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
2719 hid_err(hdev, "error in parameter\n");
2724 hid_err(hdev, "error in report\n");
2759 hid_err(hdev, "error in report\n");
2791 v = hid_snto32(hid_field_extract(hdev, data+3, 0, 12), 12);
2794 v = hid_snto32(hid_field_extract(hdev, data+3, 12, 12), 12);
2827 static int m560_input_mapping(struct hid_device *hdev, struct hid_input *hi,
2875 static int k400_allocate(struct hid_device *hdev)
2877 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
2880 k400 = devm_kzalloc(&hdev->dev, sizeof(struct k400_private_data),
2890 static int k400_connect(struct hid_device *hdev, bool connected)
2892 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3000 static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3219 static u8 *hidpp_report_fixup(struct hid_device *hdev, u8 *rdesc,
3222 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3228 if (hdev->group == HID_GROUP_LOGITECH_27MHZ_DEVICE ||
3235 static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3239 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3245 return wtp_input_mapping(hdev, hi, field, usage, bit, max);
3248 return m560_input_mapping(hdev, hi, field, usage, bit, max);
3250 if (hdev->product == DINOVO_MINI_PRODUCT_ID)
3251 return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max);
3256 static int hidpp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
3260 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3295 static int hidpp_input_configured(struct hid_device *hdev,
3298 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3388 static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report,
3391 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3401 hid_err(hdev, "received hid++ report of bad size (%d)",
3409 hid_err(hdev, "received hid++ report of bad size (%d)",
3417 hid_err(hdev, "received hid++ report of bad size (%d)",
3431 return wtp_raw_event(hdev, data, size);
3433 return m560_raw_event(hdev, data, size);
3438 static int hidpp_event(struct hid_device *hdev, struct hid_field *field,
3444 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3550 static void hidpp_overwrite_name(struct hid_device *hdev)
3552 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3561 hid_err(hdev, "unable to retrieve the name of the device");
3564 snprintf(hdev->name, sizeof(hdev->name), "%s", name);
3584 static struct input_dev *hidpp_allocate_input(struct hid_device *hdev)
3586 struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev);
3587 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3592 input_set_drvdata(input_dev, hdev);
3597 input_dev->phys = hdev->phys;
3598 input_dev->uniq = hdev->uniq;
3599 input_dev->id.bustype = hdev->bus;
3600 input_dev->id.vendor = hdev->vendor;
3601 input_dev->id.product = hdev->product;
3602 input_dev->id.version = hdev->version;
3603 input_dev->dev.parent = &hdev->dev;
3610 struct hid_device *hdev = hidpp->hid_dev;
3627 ret = wtp_connect(hdev, connected);
3631 ret = m560_send_config_command(hdev, connected);
3635 ret = k400_connect(hdev, connected);
3663 hid_err(hdev, "Can not get the protocol version.\n");
3675 if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) {
3678 devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
3713 input = hidpp_allocate_input(hdev);
3715 hid_err(hdev, "cannot allocate new input device: %d\n", ret);
3739 static int hidpp_get_report_length(struct hid_device *hdev, int id)
3744 re = &(hdev->report_enum[HID_OUTPUT_REPORT]);
3752 static u8 hidpp_validate_device(struct hid_device *hdev)
3754 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3759 report_length = hidpp_get_report_length(hdev, id);
3768 report_length = hidpp_get_report_length(hdev, id);
3777 report_length = hidpp_get_report_length(hdev, id);
3790 hid_warn(hdev, "not enough values in hidpp report %d\n", id);
3794 static bool hidpp_application_equals(struct hid_device *hdev,
3800 report_list = &hdev->report_enum[HID_INPUT_REPORT].report_list;
3805 static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
3814 hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL);
3818 hidpp->hid_dev = hdev;
3819 hidpp->name = hdev->name;
3821 hid_set_drvdata(hdev, hidpp);
3823 ret = hid_parse(hdev);
3825 hid_err(hdev, "%s:parse failed\n", __func__);
3832 hidpp->supported_reports = hidpp_validate_device(hdev);
3835 hid_set_drvdata(hdev, NULL);
3836 devm_kfree(&hdev->dev, hidpp);
3837 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
3844 hidpp_application_equals(hdev, HID_GD_MOUSE))
3849 hidpp_application_equals(hdev, HID_GD_KEYBOARD))
3853 ret = wtp_allocate(hdev, id);
3857 ret = k400_allocate(hdev);
3867 ret = sysfs_create_group(&hdev->dev.kobj, &ps_attribute_group);
3869 hid_warn(hdev, "Cannot allocate sysfs group for %s\n",
3870 hdev->name);
3873 * First call hid_hw_start(hdev, 0) to allow IO without connecting any
3875 * name and serial number and store these in hdev->name and hdev->uniq,
3878 ret = hid_hw_start(hdev, 0);
3880 hid_err(hdev, "hw start failed\n");
3884 ret = hid_hw_open(hdev);
3886 dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n",
3892 hid_device_io_start(hdev);
3904 hid_err(hdev, "Device not connected");
3908 hidpp_overwrite_name(hdev);
3928 ret = hid_connect(hdev, connect_mask);
3930 hid_err(hdev, "%s:hid_connect returned error %d\n", __func__, ret);
3946 hid_hw_close(hdev);
3950 hid_hw_close(hdev);
3952 hid_hw_stop(hdev);
3954 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
3960 static void hidpp_remove(struct hid_device *hdev)
3962 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3965 return hid_hw_stop(hdev);
3967 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
3969 hid_hw_stop(hdev);