libftdi Archives

Subject: Re: [libftdi-1.0] Limit read buffer chunksize to 16384 on Linux

From: Jie Zhang <jzhang918@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 14 Feb 2010 15:07:51 +0800
On Sun, Feb 14, 2010 at 9:33 AM, Michael Plante
<michael.plante@xxxxxxxxx> wrote:
> Jie Zhang wrote:
>>> We can't set readbuffer_chunksize larger than MAX_BULK_BUFFER_LENGTH,
>>> which is defined in libusb-1.0, on Linux. Otherwise, each USB read
>>> request will be divided into multiple (to be exactly, 4) URBs. The
>>> last 3 URBs of these 4 URBs will usually result in abnormal reaps
>>> because we usually request small number of data. The abnormal reaps
>>> will concatenate empty ftdi packets to other packet on Linux kernel
>>> older than 2.6.32. libftdi cannot parse such combined packet. This
>>> will cause issue for UrJTAG when using libftdi-1.0 with libusb-1.0. I
>>> have committed this patch on the libftdi-1.0 git tree.
>
> In other words, the status bytes issue only happened with very large reads,
> or is there something else going on that I'm missing?  If the former, I
> hadn't seen that context on any of the emails...  Anyway, good catch
>
Yes. It should only happen with very large reads. But libftdi always
calls libusb_bulk_transfer with size = ftdi->readbuffer_chunksize,
which is set to (64 * 1024) in UrJTAG. I can decrease it in UrJTAG,
but I think libftdi is a better place to do that in case other libftdi
users might set it to very large size.

Jie

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

Current Thread