usb4java/libusb4java

bulkTranfer

Opened this issue · 0 comments

Hi,

I think the LibUsb.c bulkTransfer(...) function is not implemented correctly.
It is using a ByteBuffer to receive the data to be transmitted. But it is not evaluating/updating the position/limit fields.
It only retrieves the array pointer and uses the capacity.
That forces the callee code to allocate the ByteBuffer for each call. It could have better performance if the starting to read at position, updates the read amount of bytes by increasing the position and take the limit into account (instead of the capacity).

This would make the "transferred" parameter no more needed.

Frank