use_serial is used in all devices beside AM types. So move out of the switch(ftdi...
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Tue, 14 Sep 2010 14:07:56 +0000 (16:07 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 20 Sep 2010 13:34:45 +0000 (15:34 +0200)
src/ftdi.c

index 0db9a4d..39337b6 100644 (file)
@@ -2470,6 +2470,13 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
 
     output[0x13] = serial_size*2 + 2;
 
+    if(ftdi->type > TYPE_AM) /*use_serial not used in AM devices*/
+    {
+        if (eeprom->use_serial == USE_SERIAL_NUM )
+            output[0x0A] |= USE_SERIAL_NUM;
+        else
+            output[0x0A] &= ~USE_SERIAL_NUM;
+    }
     /* Fixme: ftd2xx seems to append 0x02, 0x03 and 0x01 for PnP = 0 or 0x00 else */
     // calculate checksum
 
@@ -2482,10 +2489,6 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
     case TYPE_BM:
         output[0x0C] = eeprom->usb_version & 0xff;
         output[0x0D] = (eeprom->usb_version>>8) & 0xff;
-        if (eeprom->use_serial == 1)
-            output[0x0A] |= 0x8;
-        else
-            output[0x0A] &= ~0x8;
         output[0x14] = eeprom->chip;
         break;
     case TYPE_2232C:
@@ -2524,10 +2527,6 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             output[0x0A] |= 0x4;
         else
             output[0x0A] &= ~0x4;
-        if (eeprom->use_serial == USE_SERIAL_NUM )
-            output[0x0A] |= USE_SERIAL_NUM;
-        else
-            output[0x0A] &= ~0x8;
         output[0x0C] = eeprom->usb_version & 0xff;
         output[0x0D] = (eeprom->usb_version>>8) & 0xff;
         output[0x14] = eeprom->chip;
@@ -2541,10 +2540,6 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             output[0x0A] |= 0x4;
         else
             output[0x0A] &= ~0x4;
-        if (eeprom->use_serial == USE_SERIAL_NUM)
-            output[0x0A] |= USE_SERIAL_NUM;
-        else
-            output[0x0A] &= ~0x8;
         output[0x0B] = eeprom->invert;
         output[0x0C] = eeprom->usb_version & 0xff;
         output[0x0D] = (eeprom->usb_version>>8) & 0xff;