Skip to content

Commit 3a75b24

Browse files
bentissJiri Kosina
authored andcommitted
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>
1 parent 3c86726 commit 3a75b24

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎drivers/hid/hidraw.c‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
123123

124124
dev = hidraw_table[minor]->hid;
125125

126-
if (!dev->hid_output_raw_report) {
127-
ret = -ENODEV;
128-
goto out;
129-
}
130126

131127
if (count > HID_MAX_BUFFER_SIZE) {
132128
hid_warn(dev, "pid %d passed too large report\n",
@@ -153,7 +149,20 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
153149
goto out_free;
154150
}
155151

156-
ret = hid_output_raw_report(dev, buf, count, report_type);
152+
if (report_type == HID_OUTPUT_REPORT) {
153+
ret = hid_hw_output_report(dev, buf, count);
154+
/*
155+
* compatibility with old implementation of USB-HID and I2C-HID:
156+
* if the device does not support receiving output reports,
157+
* on an interrupt endpoint, fallback to SET_REPORT HID command.
158+
*/
159+
if (ret != -ENOSYS)
160+
goto out_free;
161+
}
162+
163+
ret = hid_hw_raw_request(dev, buf[0], buf, count, report_type,
164+
HID_REQ_SET_REPORT);
165+
157166
out_free:
158167
kfree(buf);
159168
out:

0 commit comments

Comments
 (0)