Multiple FT232H Devices On A Single Computer
The current implementation of FT232H only works if a single such device is connected to the computer.
The determination of the USB device to open is done by matching idVentor:idProduct
. If multiple dongles are connected, then there are multiple devices with the given idVentor:idProduct
. In this case, the first matched device is used in all cases.
The libftdi1 library does have methods to get around this problem via ftdi_usb_open_desc and ftdi_usb_open_desc_index. They add the ability to match a description string, serial number or the index. Both are exposed in libmpsse using Open and OpenIndex.
The only question is how to use these extra properties to identify the dongles.
Using the index is most straight forward to implement, but unstable. It is unclear how the index is determined. Is it the order the devices are plugged in or related to position on the USB bus? Also does the index of "device 1" change if you disconnect "device 0"?
The serial number seems practically the most straight forward and stable. But the FT232H spec indicates that the default serial number of a device is None. Running lsusb
confirms this:
idVendor 0x0403 Future Technology Devices International, Ltd
idProduct 0x6014 FT232H Single HS USB-UART/FIFO IC
bcdDevice 9.00
iManufacturer 1 (error)
iProduct 2 (error)
iSerial 3 (error)
My understanding is that the serial number is set in the EEPROM. The EEPROM fields can be configured using the FT_PROG Windows-only utility. This provides a nice GUI where you can edit the different fields stored in the EEPROM. On Linux, one can use the ftdi_eeprom program to read and write the EEPROM. However that deals with raw data only with undocumented structure. A quick Google search did not show any third-party documentation on this.
My proposal would be to reverse engineer the structure of EEPROM data used by the FT232H and write a utility to update the serial number.
For reference, here is a dump of the EEPROM on the Adafruit FT232H dongle.
0000000 0000 0403 6014 0900 3280 0008 0000 12a0
0000010 0eb2 12c0 0000 0000 0000 0000 0067 0000
0000020 0312 0041 0064 0061 0066 0072 0075 0069
0000030 0074 030e 0046 0054 0032 0033 0032 0048
0000040 0312 0046 0054 0054 005a 0031 0036 0047
0000050 0057 0302 0000 0000 0000 0000 0000 0000
0000060 0000 0000 0000 0000 0000 0000 0000 0000
0000070 0000 0000 0000 0000 0000 0000 0000 baf8
0000080 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000100