X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fhid%2Fhidraw.c;h=9c2d7c23f2966f43953626b82d03cf62bca0c8ba;hb=ad90fb97515b732bc27a0109baa10af636c3c8cd;hp=ab24ce2eb28f484e30fa0994cd2781994ff7d22d;hpb=67dadcb324c2fe059cb2c35f8b80df42bb23f7c4;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index ab24ce2eb28f..9c2d7c23f296 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -123,10 +123,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, dev = hidraw_table[minor]->hid; - if (!dev->hid_output_raw_report) { - ret = -ENODEV; - goto out; - } if (count > HID_MAX_BUFFER_SIZE) { hid_warn(dev, "pid %d passed too large report\n", @@ -153,7 +149,21 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, goto out_free; } - ret = dev->hid_output_raw_report(dev, buf, count, report_type); + if ((report_type == HID_OUTPUT_REPORT) && + !(dev->quirks & HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP)) { + ret = hid_hw_output_report(dev, buf, count); + /* + * compatibility with old implementation of USB-HID and I2C-HID: + * if the device does not support receiving output reports, + * on an interrupt endpoint, fallback to SET_REPORT HID command. + */ + if (ret != -ENOSYS) + goto out_free; + } + + ret = hid_hw_raw_request(dev, buf[0], buf, count, report_type, + HID_REQ_SET_REPORT); + out_free: kfree(buf); out: @@ -189,7 +199,7 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t dev = hidraw_table[minor]->hid; - if (!dev->hid_get_raw_report) { + if (!dev->ll_driver->raw_request) { ret = -ENODEV; goto out; } @@ -216,14 +226,15 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t /* * Read the first byte from the user. This is the report number, - * which is passed to dev->hid_get_raw_report(). + * which is passed to hid_hw_raw_request(). */ if (copy_from_user(&report_number, buffer, 1)) { ret = -EFAULT; goto out_free; } - ret = dev->hid_get_raw_report(dev, report_number, buf, count, report_type); + ret = hid_hw_raw_request(dev, report_number, buf, count, report_type, + HID_REQ_GET_REPORT); if (ret < 0) goto out_free;