When reading EEPROM strings, clip active, as rollover doesn't work for the FT2232R
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Wed, 8 Sep 2010 17:07:48 +0000 (19:07 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 20 Sep 2010 13:34:37 +0000 (15:34 +0200)
src/ftdi.c

index 81fd2d5..3908615 100644 (file)
@@ -2561,7 +2561,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, unsigned char *buf, int size,
         if (eeprom->manufacturer)
         {
             // Decode manufacturer
-            i = buf[0x0E]; // offset
+            i = buf[0x0E] & (eeprom_size -1); // offset
             for (j=0;j<manufacturer_size-1;j++)
             {
                 eeprom->manufacturer[j] = buf[2*j+i+2];
@@ -2580,7 +2580,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, unsigned char *buf, int size,
         if(eeprom->product)
         {
             // Decode product name
-            i = buf[0x10]; // offset
+            i = buf[0x10] & (eeprom_size -1); // offset
             for (j=0;j<product_size-1;j++)
             {
                 eeprom->product[j] = buf[2*j+i+2];
@@ -2599,7 +2599,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, unsigned char *buf, int size,
         if(eeprom->serial)
         {
             // Decode serial
-            i = buf[0x12]; // offset
+            i = buf[0x12] & (eeprom_size -1); // offset
             for (j=0;j<serial_size-1;j++)
             {
                 eeprom->serial[j] = buf[2*j+i+2];