libftdi Archives

Subject: possible bug in_usb_bulk_write_async?

From: Akos Vandra <axos88@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 11 Dec 2011 13:33:06 +0100
Hi!

I am looking at the sources of libftdi, because I need to have async
read functionality with exposing the correct file descriptor for
select().
I was looking at the source of _usb_bulk_write_async, when I realized
there might be a bug there.

If there is no free URB, the function returns -1, indicating it could
not submit a new urb. However, that is within a do {} while loop, and
if the user reques a very large transfer, let's say 1MB, in chunks of
100bytes, then the function will eventually run out of free URBs, and
thus return -1. However that is not correct functioning as it should
return the number of bytes that have been sucessfully transferred.

I think the solution might be checking for (bytesdone > 0) when the
urb  == NULL evaluates to true.

Also I would like to ask why are you still using ioctl to submit the
url, as libusb-1.0 has functions to do that, and as far as I know
libftdi is now based on libusb-1.0?

Regards,
  Ákos Vandra

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

Current Thread