On Monday, 23. March 2009 00:07:35 David Challis wrote:
> Here is my final answer:
>
> The ft2232H spaces the modem status bytes every 512 bytes rather that the
> expected 64 byte interval of prior chips like the ft245. Libftdi will have
> to be changed to detect the type of chip connected and adapt the
> ftdi_read_data() routine to handle the appropriate spacing between modem
> status bytes.
Good work! Maybe the attached patch will help you.
Cheers,
Thomas
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [email protected]
diff --git a/src/ftdi.c b/src/ftdi.c
index c62ede7..a931c43 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -438,6 +438,8 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct usb_device *dev)
}
else if (dev->descriptor.bcdDevice == 0x600)
ftdi->type = TYPE_R;
+ else if (dev->descriptor.bcdDevice == 0x800)
+ ftdi->type = TYPE_2232H;
ftdi_error_return(0, "all fine");
}
diff --git a/src/ftdi.h b/src/ftdi.h
index 937d15d..769f154 100644
--- a/src/ftdi.h
+++ b/src/ftdi.h
@@ -22,7 +22,7 @@
#define FTDI_DEFAULT_EEPROM_SIZE 128
/** FTDI chip type */
-enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3 };
+enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3, TYPE_2232H=4 };
/** Parity mode for ftdi_set_line_property() */
enum ftdi_parity_type { NONE=0, ODD=1, EVEN=2, MARK=3, SPACE=4 };
/** Number of stop bits for ftdi_set_line_property() */