ftdi_eeprom_build(): Fix inverted handling of VCP driver field for TYPE_R chips
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 14 May 2020 21:00:24 +0000 (23:00 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 27 May 2020 18:24:15 +0000 (20:24 +0200)
From doc/EEPROM-structure:

    On TYPE_R 00.3 set means D2XX, on other devices VCP

-> invert the field for TYPE_R so "eeprom->channel_a_driver"
   set to 1 always means VCP driver for all chips.

doc/EEPROM-structure
src/ftdi.c

index 08abe62..4a590b6 100644 (file)
@@ -19,7 +19,7 @@ Byte.BIT| TYPE_AM TYPE_BM   TYPE_2232C       TYPE_R          TYPE_2232H       TY
 00.7    |      0       0   0                0                SUSPEND_DBUS7    channel_c_driver
 
 On TYPE_R 00.0 is set for the FT245R and cleared for the FT232R
-On TYPE_R 00.3 set mean D2XX, on other devices VCP
+On TYPE_R 00.3 set means D2XX, on other devices VCP
 
 01.0    |      0       0   channel_b_type                    channel_b_type   0
 01.1    |      0       0   channel_b_type                    channel_b_type   0
index d86d98e..d527d6f 100644 (file)
@@ -3182,8 +3182,13 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             output[0x00] = type2bit(eeprom->channel_a_type, TYPE_R);
             if (eeprom->high_current)
                 output[0x00] |= HIGH_CURRENT_DRIVE_R;
+
+            /* Field is inverted for TYPE_R: Bit 00.3 set to 1 is D2XX, VCP is 0 */
             if (eeprom->channel_a_driver)
+                output[0x00] &= ~DRIVER_VCP;
+            else
                 output[0x00] |= DRIVER_VCP;
+
             if (eeprom->external_oscillator)
                 output[0x00] |= 0x02;
             output[0x01] = 0x40; /* Hard coded Endpoint Size*/