--
Uwe Bonnes bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From f83c34ec89fd193d077323edc1a3a592d1eb890b Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 2 Oct 2010 16:33:53 +0200
Subject: Decode/Encode use_usb_version on BM and 2232C
---
src/ftdi.c | 23 ++++++++++++++++-------
src/ftdi.h | 6 +++++-
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/ftdi.c b/src/ftdi.c
index e33572b..0b19838 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -2490,6 +2490,11 @@ 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_usb_version == USE_USB_VERSION_BIT)
+ output[0x0A] |= USE_USB_VERSION_BIT;
+ else
+ output[0x0A] &= ~USE_USB_VERSION_BIT;
+
break;
case TYPE_2232C:
@@ -2527,6 +2532,11 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
output[0x0A] |= 0x4;
else
output[0x0A] &= ~0x4;
+ if (eeprom->use_usb_version == USE_USB_VERSION_BIT)
+ output[0x0A] |= USE_USB_VERSION_BIT;
+ else
+ output[0x0A] &= ~USE_USB_VERSION_BIT;
+
output[0x0C] = eeprom->usb_version & 0xff;
output[0x0D] = (eeprom->usb_version>>8) & 0xff;
output[0x14] = eeprom->chip;
@@ -2704,8 +2714,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int
verbose)
// Bit 7: 0 - reserved
// Bit 6: 0 - reserved
// Bit 5: 0 - reserved
- // Bit 4: 1 - Change USB version
- // Not seen on FT2232(D)
+ // Bit 4: 1 - Change USB version on BM and 2232C
// Bit 3: 1 - Use the serial number string
// Bit 2: 1 - Enable suspend pull downs for lower power
// Bit 1: 1 - Out EndPoint is Isochronous
@@ -2715,11 +2724,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int
verbose)
eeprom->out_is_isochronous = buf[0x0A]&0x02;
eeprom->suspend_pull_downs = buf[0x0A]&0x04;
eeprom->use_serial = buf[0x0A] & USE_SERIAL_NUM;
- if(buf[0x0A]&0x10)
- fprintf(stderr,
- "EEPROM byte[0x0a] Bit 4 unexpected set. If this happened with
the EEPROM\n"
- "programmed by FTDI tools, please report to
libftdi@xxxxxxxxxxxxxxxxxxxxxxx\n");
-
+ eeprom->use_usb_version = buf[0x0A] & USE_USB_VERSION_BIT;
// Addr 0C: USB version low byte when 0x0A
// Addr 0D: USB version high byte when 0x0A
@@ -2913,6 +2918,10 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int
verbose)
channel_mode[eeprom->channel_b_type],
(eeprom->channel_b_driver)?" VCP":"",
(eeprom->high_current_b)?" High Current IO":"");
+ if (((ftdi->type == TYPE_BM) || (ftdi->type == TYPE_2232C)) &&
+ eeprom->use_usb_version == USE_USB_VERSION_BIT)
+ fprintf(stdout,"Use explicit USB Version
%04x\n",eeprom->usb_version);
+
if ((ftdi->type == TYPE_2232H) || (ftdi->type == TYPE_4232H))
{
fprintf(stdout,"%s has %d mA drive%s%s\n",
diff --git a/src/ftdi.h b/src/ftdi.h
index 0de2e9b..782df96 100644
--- a/src/ftdi.h
+++ b/src/ftdi.h
@@ -199,7 +199,9 @@ struct ftdi_eeprom
int use_serial;
/** usb version */
int usb_version;
- /** maximum power */
+ /** Use usb version on FT2232 devices*/
+ int use_usb_version;
+ /** maximum power */
int max_power;
/** manufacturer name */
@@ -410,6 +412,8 @@ enum ftdi_cbus_func {/* FIXME: Recheck value, especially
the last */
/** Driver Type. */
#define DRIVER_VCP 0x08
+#define USE_USB_VERSION_BIT 0x10
+
#define SUSPEND_DBUS7_BIT 0x80
/** High current drive. */
--
1.7.1
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|