@@ -874,18 +874,8 @@ static int usbhid_get_raw_report(struct hid_device *hid,
struct usb_device *dev = hid_to_usb_dev(hid);
struct usb_interface *intf = usbhid->intf;
struct usb_host_interface *interface = intf->cur_altsetting;
- int skipped_report_id = 0;
int ret;
- /* Byte 0 is the report number. Report data starts at byte 1.*/
- buf[0] = report_number;
- if (report_number == 0x0) {
- /* Offset the return buffer by 1, so that the report ID
- will remain in byte 0. */
- buf++;
- count--;
- skipped_report_id = 1;
- }
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
HID_REQ_GET_REPORT,
USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
@@ -893,10 +883,6 @@ static int usbhid_get_raw_report(struct hid_device *hid,
interface->desc.bInterfaceNumber, buf, count,
USB_CTRL_SET_TIMEOUT);
- /* count also the report id */
- if (ret > 0 && skipped_report_id)
- ret++;
-
return ret;
}
Report ID of zero is a special case for ID-less reports, which by definition do not have report ID as a part of their payload. Not returning an extra zero also matches hidraw documentation, specifically: For devices which do not use numbered reports, set the first byte to 0. The returned report buffer will contain the report number in the first byte, followed by the report data read from the device. For devices which do not use numbered reports, the report data will begin at the first byte of the returned buffer. Cc: David Rheinsberg <david.rheinsberg@gmail.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> --- drivers/hid/usbhid/hid-core.c | 14 -------------- 1 file changed, 14 deletions(-)