static int bthid_ll_parse(struct hid_device *hid) { int ret; unsigned char *buf; struct bthid_ctrl *p_ctrl = hid->driver_data; #ifdef CONFIG_DEBUG_PRINTK printk(KERN_INFO "######## bthid_ll_parse: hid = %p ########\n", hid); #else ; #endif buf = kmalloc(p_ctrl->size, GFP_KERNEL); if (!buf) { return -ENOMEM; } memcpy(buf, p_ctrl->buf, p_ctrl->size); ret = hid_parse_report(hid, buf, p_ctrl->size); kfree(buf); #ifdef CONFIG_DEBUG_PRINTK printk(KERN_INFO "######## bthid_ll_parse: status = %d, ret = %d ########\n", hid->status, ret); #else ; #endif return ret; }
static int mousevsc_hid_parse(struct hid_device *hid) { struct hv_device *dev = hid_get_drvdata(hid); struct mousevsc_dev *input_dev = hv_get_drvdata(dev); return hid_parse_report(hid, input_dev->report_desc, input_dev->report_desc_size); }
static int logi_dj_ll_parse(struct hid_device *hid) { struct dj_device *djdev = hid->driver_data; unsigned int rsize = 0; char *rdesc; int retval; dbg_hid("%s\n", __func__); djdev->hdev->version = 0x0111; djdev->hdev->country = 0x00; rdesc = kmalloc(MAX_RDESC_SIZE, GFP_KERNEL); if (!rdesc) return -ENOMEM; if (djdev->reports_supported & STD_KEYBOARD) { dbg_hid("%s: sending a kbd descriptor, reports_supported: %x\n", __func__, djdev->reports_supported); rdcat(&rdesc, &rsize, kbd_descriptor, sizeof(kbd_descriptor)); } if (djdev->reports_supported & STD_MOUSE) { dbg_hid("%s: sending a mouse descriptor, reports_supported: " "%x\n", __func__, djdev->reports_supported); rdcat(&rdesc, &rsize, mse_descriptor, sizeof(mse_descriptor)); } if (djdev->reports_supported & MULTIMEDIA) { dbg_hid("%s: sending a multimedia report descriptor: %x\n", __func__, djdev->reports_supported); rdcat(&rdesc, &rsize, consumer_descriptor, sizeof(consumer_descriptor)); } if (djdev->reports_supported & POWER_KEYS) { dbg_hid("%s: sending a power keys report descriptor: %x\n", __func__, djdev->reports_supported); rdcat(&rdesc, &rsize, syscontrol_descriptor, sizeof(syscontrol_descriptor)); } if (djdev->reports_supported & MEDIA_CENTER) { dbg_hid("%s: sending a media center report descriptor: %x\n", __func__, djdev->reports_supported); rdcat(&rdesc, &rsize, media_descriptor, sizeof(media_descriptor)); } if (djdev->reports_supported & KBD_LEDS) { dbg_hid("%s: need to send kbd leds report descriptor: %x\n", __func__, djdev->reports_supported); } retval = hid_parse_report(hid, rdesc, rsize); kfree(rdesc); return retval; }
static int bthid_ll_parse(struct hid_device *hid) { int ret; unsigned char *buf; struct bthid_ctrl *p_ctrl = hid->driver_data; printk(KERN_INFO "######## bthid_ll_parse: hid = %p ########\n", hid); buf = kmalloc(p_ctrl->size, GFP_KERNEL); if (!buf) return -ENOMEM; memcpy(buf, p_ctrl->buf, p_ctrl->size); ret = hid_parse_report(hid, buf, p_ctrl->size); kfree(buf); printk(KERN_INFO "######## bthid_ll_parse: status = %d, \ ret = %d ########\n", hid->status, ret); return ret; }
static int logi_dj_ll_parse(struct hid_device *hid) { struct dj_device *djdev = hid->driver_data; int retval; dbg_hid("%s\n", __func__); djdev->hdev->version = 0x0111; djdev->hdev->country = 0x00; if (djdev->reports_supported & STD_KEYBOARD) { dbg_hid("%s: sending a kbd descriptor, reports_supported: %x\n", __func__, djdev->reports_supported); retval = hid_parse_report(hid, (u8 *) kbd_descriptor, sizeof(kbd_descriptor)); if (retval) { dbg_hid("%s: sending a kbd descriptor, hid_parse failed" " error: %d\n", __func__, retval); return retval; } } if (djdev->reports_supported & STD_MOUSE) { dbg_hid("%s: sending a mouse descriptor, reports_supported: " "%x\n", __func__, djdev->reports_supported); retval = hid_parse_report(hid, (u8 *) mse_descriptor, sizeof(mse_descriptor)); if (retval) { dbg_hid("%s: sending a mouse descriptor, hid_parse " "failed error: %d\n", __func__, retval); return retval; } } if (djdev->reports_supported & MULTIMEDIA) { dbg_hid("%s: sending a multimedia report descriptor: %x\n", __func__, djdev->reports_supported); retval = hid_parse_report(hid, (u8 *) consumer_descriptor, sizeof(consumer_descriptor)); if (retval) { dbg_hid("%s: sending a consumer_descriptor, hid_parse " "failed error: %d\n", __func__, retval); return retval; } } if (djdev->reports_supported & POWER_KEYS) { dbg_hid("%s: sending a power keys report descriptor: %x\n", __func__, djdev->reports_supported); retval = hid_parse_report(hid, (u8 *) syscontrol_descriptor, sizeof(syscontrol_descriptor)); if (retval) { dbg_hid("%s: sending a syscontrol_descriptor, " "hid_parse failed error: %d\n", __func__, retval); return retval; } } if (djdev->reports_supported & MEDIA_CENTER) { dbg_hid("%s: sending a media center report descriptor: %x\n", __func__, djdev->reports_supported); retval = hid_parse_report(hid, (u8 *) media_descriptor, sizeof(media_descriptor)); if (retval) { dbg_hid("%s: sending a media_descriptor, hid_parse " "failed error: %d\n", __func__, retval); return retval; } } if (djdev->reports_supported & KBD_LEDS) { dbg_hid("%s: need to send kbd leds report descriptor: %x\n", __func__, djdev->reports_supported); } return 0; }
static int uhid_hid_parse(struct hid_device *hid) { struct uhid_device *uhid = hid->driver_data; return hid_parse_report(hid, uhid->rd_data, uhid->rd_size); }
static int mousevsc_probe(struct hv_device *device, const struct hv_vmbus_device_id *dev_id) { int ret; struct mousevsc_dev *input_dev; struct hid_device *hid_dev; input_dev = mousevsc_alloc_device(device); if (!input_dev) return -ENOMEM; ret = vmbus_open(device->channel, INPUTVSC_SEND_RING_BUFFER_SIZE, INPUTVSC_RECV_RING_BUFFER_SIZE, NULL, 0, mousevsc_on_channel_callback, device ); if (ret) goto probe_err0; ret = mousevsc_connect_to_vsp(device); if (ret) goto probe_err1; /* workaround SA-167 */ if (input_dev->report_desc[14] == 0x25) input_dev->report_desc[14] = 0x29; hid_dev = hid_allocate_device(); if (IS_ERR(hid_dev)) { ret = PTR_ERR(hid_dev); goto probe_err1; } hid_dev->ll_driver = &mousevsc_ll_driver; hid_dev->driver = &mousevsc_hid_driver; hid_dev->bus = BUS_VIRTUAL; hid_dev->vendor = input_dev->hid_dev_info.vendor; hid_dev->product = input_dev->hid_dev_info.product; hid_dev->version = input_dev->hid_dev_info.version; input_dev->hid_device = hid_dev; sprintf(hid_dev->name, "%s", "Microsoft Vmbus HID-compliant Mouse"); ret = hid_add_device(hid_dev); if (ret) goto probe_err1; ret = hid_parse_report(hid_dev, input_dev->report_desc, input_dev->report_desc_size); if (ret) { hid_err(hid_dev, "parse failed\n"); goto probe_err2; } ret = hid_hw_start(hid_dev, HID_CONNECT_HIDINPUT | HID_CONNECT_HIDDEV); if (ret) { hid_err(hid_dev, "hw start failed\n"); goto probe_err2; } input_dev->connected = true; input_dev->init_complete = true; return ret; probe_err2: hid_destroy_device(hid_dev); probe_err1: vmbus_close(device->channel); probe_err0: mousevsc_free_device(input_dev); return ret; }