From 54eb31dc16dcc67d0b689ed947bc53a038608c0e Mon Sep 17 00:00:00 2001 From: Alan Ott Date: Mon, 18 Aug 2014 11:17:13 -0400 Subject: [PATCH] windows: Return the correct length from hid_get_feature_report() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Windows DeviceIoControl() doesn't account for the report ID byte. Reported-by: Petr StehlĂ­k --- windows/hid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/windows/hid.c b/windows/hid.c index b3556774..427bcd1c 100755 --- a/windows/hid.c +++ b/windows/hid.c @@ -791,6 +791,12 @@ int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned register_error(dev, "Send Feature Report GetOverLappedResult"); return -1; } + + /* bytes_returned does not include the first byte which contains the + report ID. The data buffer actually contains one more byte than + bytes_returned. */ + bytes_returned++; + return bytes_returned; #endif }