Hello Uwe,
On Friday, 25. June 2010 18:03:07 Uwe Bonnes wrote:
> I would expect that the ftdi_read_data() call returns when either the
> requested number of bytes has been read or when zero of fewer then the
> requested number of bytes has been read _and_ the timeout happened.
Sounds reasonable, atleast in a blocking-mode.
> However the present implementation returns immediate, without waiting the
> usb_read_timeout. This happens as
>
> ret = libusb_bulk_transfer (ftdi->usb_dev, ftdi->out_ep,\
> ftdi->readbuffer, ftdi->readbuffer_chunksize,
> &actual_length, ftdi->usb_read_timeout);
>
> will immediate return the two status bytes and
>
> else if (actual_length <= 2)
> {
> // no more data to read?
> return offset;
>
> will always return, even when there is no data.
Ok
> Appended patch for libusb-0 now loops until the timeout has been hit or
> all bytes read or a hard error happened.
One thing comes to my mind: What happens to applications
expecting the current behavior? I'm currently trying
to figure out if this would break something. Hmm.
Cheers,
Thomas
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|