eeprom: Fix handling of high_current_drive parameter
authorHolger Mößinger <h.moessinger@primes.de>
Fri, 7 Feb 2020 13:38:46 +0000 (14:38 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 13 Apr 2020 21:00:58 +0000 (23:00 +0200)
Additionally fix it up for type R chips.

src/ftdi.c
src/ftdi_i.h

index 7234229..e82514e 100644 (file)
@@ -3136,23 +3136,23 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
         case TYPE_2232C:
 
             output[0x00] = type2bit(eeprom->channel_a_type, TYPE_2232C);
-            if ( eeprom->channel_a_driver == DRIVER_VCP)
+            if (eeprom->channel_a_driver == DRIVER_VCP)
                 output[0x00] |= DRIVER_VCP;
             else
                 output[0x00] &= ~DRIVER_VCP;
 
-            if ( eeprom->high_current_a == HIGH_CURRENT_DRIVE)
+            if (eeprom->high_current_a)
                 output[0x00] |= HIGH_CURRENT_DRIVE;
             else
                 output[0x00] &= ~HIGH_CURRENT_DRIVE;
 
             output[0x01] = type2bit(eeprom->channel_b_type, TYPE_2232C);
-            if ( eeprom->channel_b_driver == DRIVER_VCP)
+            if (eeprom->channel_b_driver == DRIVER_VCP)
                 output[0x01] |= DRIVER_VCP;
             else
                 output[0x01] &= ~DRIVER_VCP;
 
-            if ( eeprom->high_current_b == HIGH_CURRENT_DRIVE)
+            if (eeprom->high_current_b)
                 output[0x01] |= HIGH_CURRENT_DRIVE;
             else
                 output[0x01] &= ~HIGH_CURRENT_DRIVE;
@@ -3180,7 +3180,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             break;
         case TYPE_R:
             output[0x00] = type2bit(eeprom->channel_a_type, TYPE_R);
-            if (eeprom->high_current == HIGH_CURRENT_DRIVE_R)
+            if (eeprom->high_current)
                 output[0x00] |= HIGH_CURRENT_DRIVE_R;
             if (eeprom->channel_a_driver == DRIVER_VCP)
                 output[0x00] |= DRIVER_VCP;
index f62795f..1bc740d 100644 (file)
@@ -93,7 +93,7 @@ struct ftdi_eeprom
     int cbus_function[10];
     /** Select high current drive on R devices. */
     int high_current;
-    /** Select high current drive on A channel (2232C */
+    /** Select high current drive on A channel (2232C). */
     int high_current_a;
     /** Select high current drive on B channel (2232C). */
     int high_current_b;