0
votes

For a project, we have several FTDI serial to USB converters on a custom piece of hardware. Some of these serial to USB converters have special parameters that need to be set(i.e. where they are getting their data from). Now, the normal way to set this would be to use the FTD2XX library, which would allow us to set data on the USB to serial converters directly. However, the D2XX drivers can't be used at the same time as the standard ftdi_sio drivers, which means that we can't use the serial port like a normal device.

I have three basic options here:

  1. Modify the standard drivers to use new IOCTLs. Since we have a very specific environment that we're targeting, I would be fine with this, however I am not sure if it is possible to handle all the possible nuances that may come up with how the USB converter works when put into different modes.

  2. Have everything use the D2XX drivers. This is not ideal, because if we need to use another FTDI usb to serial converter, whatever program needs to use that serial converter would also have to use the D2XX drivers, which would be good until we wanted to use a different USB to serial converter(as we would then open /dev/ttyUSBX as normal)

  3. Make a fake TTY, such as /dev/serialX, which would then pass information through to the D2XX driver. That way, we could still open the serial port as normal, but we could add in new functions to do more advanced options. The naming is similar to what we do now, which is to use udev to create symlinks to the correct ports.

Option #3 would probably be the best option here, but I'm not sure exactly how to do it. I've looked into the openpty function, but that doesn't seem to do exactly what I want, mainly being able to set TTY settings on the fake serial port and have the same settings set on the real serial port. I'm guessing that mknod/mkdev would be used here somehow, but I can't figure out exactly how.

What's the best way to go around this?

1

1 Answers

0
votes

The normal way to do this is to take advantage of the fact that the FTDI chip can use a small attached EEPROM to load config settings. So instead of using D2XX to set the custom params, you burn the EEPROM, and the FTDI will autoconfigure itself. Then you just use the noraml serial port drivers.