libusb icon indicating copy to clipboard operation
libusb copied to clipboard

Interrupt_Transfer not usable

Open rbredlau opened this issue 9 years ago • 0 comments

The current implementation of Interrupt_Transfer returns:

if rc != 0 {
    return nil, &libusb_error{rc}
}

return data[:int(transferred)], nil

If libusb can only perform a partial transfer then rc will be -7 (LIBUSB_ERROR_TIMEOUT) but transferred will be a positive integer. The caller to the go implementation will recieve a nil []byte and a timeout error but no indication that anything was transferred.

This makes interrupt I/O practically impossible when the data sent/read is broken up into smaller packets and transferred piece-meal because the caller will never know that anything was sent or read.

rbredlau avatar Mar 21 '16 21:03 rbredlau