libftdi Archives

Subject: Re: Patches applied

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Jim Paris <jim@xxxxxxxx>, david-b@xxxxxxxxxxx, abc@xxxxxxxxxx
Date: Sun, 15 Nov 2009 12:51:27 +0100
Hello,

[Maximum packet size issue]
>> 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;
> 
> Like that, yes.  I'd check for null pointers and array boundaries though,
> and apply the right mask to wMaxPacketSize ... just in case.

Please give the attached patch a try. Works fine on my FT245BM type chip.

Cheers,
Thomas


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

Attachment: 0001-Determine-maximum-packet-size-via-usb-config-descrip.patch
Description: Text Data

Current Thread