Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Commit 54eb31d

Browse files
committed
windows: Return the correct length from hid_get_feature_report()
The Windows DeviceIoControl() doesn't account for the report ID byte. Reported-by: Petr Stehlík <[email protected]>
1 parent 0cbc3a4 commit 54eb31d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

windows/hid.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,12 @@ int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned
791791
register_error(dev, "Send Feature Report GetOverLappedResult");
792792
return -1;
793793
}
794+
795+
/* bytes_returned does not include the first byte which contains the
796+
report ID. The data buffer actually contains one more byte than
797+
bytes_returned. */
798+
bytes_returned++;
799+
794800
return bytes_returned;
795801
#endif
796802
}

0 commit comments

Comments
 (0)