>>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> writes:
Thomas> On Friday, 24. September 2010 16:44:48 Uwe Bonnes wrote:
>> >>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
>> writes:
Thomas> On Friday, 24. September 2010 14:20:18 Xiaofan Chen wrote:
>> >> Section "EEPROM Programming -->EEPROM Settings -->USB String >>
>> Descriptors" of the help file (chm format) has the following. >>
>> "This allows for the string descriptors that the device will use >>
>> to be changed on the EEPROM. The maximum number of characters >>
>> that the string descriptors can take is 48 including the >>
>> Manufacturer, Product Description and Serial Number strings."
>>
Thomas> Thanks for checking, I'll change the code to limit the string
Thomas> length to 48 characters in total.
>> As explained, this is wrong due to an error in AN_121. If done so,
>> it will ovveride checksum...
Thomas> What about limit it to 46 then? :)
The limit is Type dependant. Perhaps another case structure would bring
this up more clearfully. What about appended patch?
B.t.w. my last explanation was wrong, and the old calculation too. I missed
that the PNP descriptor works on a word...
--
Uwe Bonnes bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From 493162e7a2e6e8103c12de2c898e21f938fa53e2 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Sep 2010 17:12:34 +0200
Subject: Write the User area caculation correct and clearer
---
src/ftdi.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/src/ftdi.c b/src/ftdi.c
index bd81306..290a771 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -2308,7 +2308,24 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
serial_size = strlen(eeprom->serial);
// eeprom size exceeded?
- user_area_size = (48 - (manufacturer_size + product_size + serial_size)) *
2;
+
+ switch (ftdi->type) {
+ case TYPE_AM:
+ case TYPE_BM:
+ user_size_area = 96;
+ break;
+ case TYPE_2232C:
+ user_size_area = 94;
+ break;
+ case TYPE_R:
+ user_size_area = 92;
+ break;
+ case TYPE_2232H:
+ case TYPE_4232H:
+ user_size_area = 90;
+ break;
+ }
+ user_area_size -= (manufacturer_size + product_size + serial_size) * 2;
if (user_area_size < 0)
ftdi_error_return(-1,"eeprom size exceeded");
--
1.7.1
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|