Windows: Allow HID reports up to 1024 + report id

HID reports can contain up to 1024 bytes. When using a report id
the complete buffer will be 1025 bytes. Do not return an error
if the user supplies a report id and a buffer of 1025 bytes size.

Closes #222
Closes #226

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
This commit is contained in:
Stefan Agner
2016-11-01 18:27:12 -07:00
committed by Chris Dickens
parent ecc87bba6e
commit 18a1452ee8
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -3357,11 +3357,13 @@ static int _hid_set_report(struct hid_device_priv *dev, HANDLE hid_handle, int i
{
uint8_t *buf = NULL;
DWORD ioctl_code, write_size = (DWORD)*size;
// If an id is reported, we must allow MAX_HID_REPORT_SIZE + 1
size_t max_report_size = MAX_HID_REPORT_SIZE + (id ? 1 : 0);
if (tp->hid_buffer != NULL)
usbi_dbg("program assertion failed: hid_buffer is not NULL");
if ((*size == 0) || (*size > MAX_HID_REPORT_SIZE)) {
if ((*size == 0) || (*size > max_report_size)) {
usbi_dbg("invalid size (%u)", *size);
return LIBUSB_ERROR_INVALID_PARAM;
}
+1 -1
View File
@@ -1 +1 @@
#define LIBUSB_NANO 11191
#define LIBUSB_NANO 11192