Workaround for a Windows hidapi issue
The Windows HID api always expects to receive a fixed size buffer (corresponding to the largest report supported by the device). Therefore the hidapi library internally pads the buffer with zeros to the expected size, but apparently it also returns the size of the padded buffer! As a workaround the number of bytes is limited to the actual size.
This commit is contained in:
parent
b82d5fcfff
commit
c9ed92d3f5
@ -426,6 +426,12 @@ dc_usbhid_write (dc_usbhid_t *usbhid, const void *data, size_t size, size_t *act
|
||||
nbytes = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (nbytes > size) {
|
||||
nbytes = size;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
out:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user