libftdi Archives

Subject: Re: Calls to libusb_bulk_transfer() don't check for LIBUSB_ERROR_TIMEOUT

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 6 Dec 2020 10:34:12 +0800
On Sat, Aug 29, 2020 at 2:53 AM Kyle Schwarz <kschwarz@xxxxxxxxxxxxxx> wrote:
>
> In ftdi.c there are calls to libusb_bulk_transfer(), but they don't check for
> a possible LIBUSB_ERROR_TIMEOUT.
>
> A LIBUSB_ERROR_TIMEOUT isn't technically an error and shouldn't
> be handled as such.
>
> The docs for libusb describe this fairly well, but let me know if more
> information is needed to fix this.

Just wondering what is the real issue here you encountered and you
are trying to fix.

I understand that libusb documentation says the following for
libusb_bulk_transfer().
It does say timeout conditions do not indicate a complete lack of I/O. But
I think for the purpose of libftdi there is an issue in the end and the I/O
may still be incomplete or there are other errors.

http://libusb.sourceforge.net/api-1.0/group__libusb__syncio.html
Also check transferred when dealing with a timeout error code. libusb
may have to
split your transfer into a number of chunks to satisfy underlying O/S
requirements,
meaning that the timeout may expire after the first few chunks have completed.
libusb is careful not to lose any data that may have been transferred; do not
assume that timeout conditions indicate a complete lack of I/O.

-- 
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread