From: Thomas Jarosch Date: Thu, 14 May 2020 21:00:24 +0000 (+0200) Subject: ftdi_eeprom_build(): Fix inverted handling of VCP driver field for TYPE_R chips X-Git-Tag: v1.5rc1~3 X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=commitdiff_plain;h=c0182e62d7c607205652d7860e92618181b667de ftdi_eeprom_build(): Fix inverted handling of VCP driver field for TYPE_R chips 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. --- diff --git a/doc/EEPROM-structure b/doc/EEPROM-structure index 08abe62..4a590b6 100644 --- a/doc/EEPROM-structure +++ b/doc/EEPROM-structure @@ -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 diff --git a/src/ftdi.c b/src/ftdi.c index d86d98e..d527d6f 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -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*/