Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: hidraw: replace hid_output_raw_report() calls by appropriates ones

Remove hid_output_raw_report() call as it is not a ll_driver callbacj,
and switch to the hid_hw_* implementation. USB-HID used to fallback
into SET_REPORT when there were no output interrupt endpoint,
so emulating this if hid_hw_output_report() returns -ENOSYS.

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Benjamin Tissoires and committed by
Jiri Kosina
3a75b249 3c86726c

+14 -5
+14 -5
drivers/hid/hidraw.c
··· 123 123 124 124 dev = hidraw_table[minor]->hid; 125 125 126 - if (!dev->hid_output_raw_report) { 127 - ret = -ENODEV; 128 - goto out; 129 - } 130 126 131 127 if (count > HID_MAX_BUFFER_SIZE) { 132 128 hid_warn(dev, "pid %d passed too large report\n", ··· 149 153 goto out_free; 150 154 } 151 155 152 - ret = hid_output_raw_report(dev, buf, count, report_type); 156 + if (report_type == HID_OUTPUT_REPORT) { 157 + ret = hid_hw_output_report(dev, buf, count); 158 + /* 159 + * compatibility with old implementation of USB-HID and I2C-HID: 160 + * if the device does not support receiving output reports, 161 + * on an interrupt endpoint, fallback to SET_REPORT HID command. 162 + */ 163 + if (ret != -ENOSYS) 164 + goto out_free; 165 + } 166 + 167 + ret = hid_hw_raw_request(dev, buf[0], buf, count, report_type, 168 + HID_REQ_SET_REPORT); 169 + 153 170 out_free: 154 171 kfree(buf); 155 172 out: