libftdi Archives

Subject: Re: Patches applied

From: Jim Paris <jim@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 10 Nov 2009 16:10:10 -0500
Thomas Jarosch wrote:
> Hello,
> 
> I guess I've applied all outstanding patches to libftdi's git tree.
> Please ping me if I might have missed one/yours.
> 
> Now we just need a fix for the
> 
> "FT2232H bug: wrong maxpacket at full speed" 
> 
> issue ;)

Probably something like the below patch.  Note, only lightly tested
(it returns 64 on my full-speed device here), and maybe it's something
that should instead be stored in ftdi_context every time the interface
changes.

-jim


diff --git a/src/ftdi.c b/src/ftdi.c
index d7f4bb0..26d08a4 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1268,11 +1268,7 @@ int ftdi_read_data(struct ftdi_context *ftdi, unsigned 
char *buf, int size)
     int offset = 0, ret = 1, i, num_of_chunks, chunk_remains;
     int packet_size;
 
-    // New hi-speed devices from FTDI use a packet size of 512 bytes
-    if (ftdi->type == TYPE_2232H || ftdi->type == TYPE_4232H)
-        packet_size = 512;
-    else
-        packet_size = 64;
+    packet_size = 
usb_device(ftdi->usb_dev)->config[0].interface[ftdi->interface].altsetting[0].endpoint[0].wMaxPacketSize;
 
     // everything we want is still in the readbuffer?
     if (size <= ftdi->readbuffer_remaining)

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

Current Thread