libftdi Archives

Subject: Re: Identifying multiple of the same FTDI devices

From: Michael Eder <ozeansoftware@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 9 Jun 2016 13:40:36 -0400
Thanks this seems to be a solution if I can get a unique identifier for my FTDI device.  Problem I see with this approach is that because I am using the I2C I have to unbind  the ftdi_sio driver.  Can I get the unique serial number for the FTDI device through libftdi?

On Thu, Jun 9, 2016 at 12:36 PM, Ryan Tennill <rtennill@xxxxxxxxxxxxxxxx> wrote:
On 06/09/2016 10:55 AM, Michael Eder wrote:
I have a question related to how one can distinguish between the devices when there are multiples of the same FTDI devices plugged into a USB hub?

I suspect the answer is to program the FTDI devices with a unique name in its EEPROM, but is there a way short of that how I can identify what device is plugged in where?

Simple example.  I have two temperature I2C devices that have the same fixed I2C address.  I need to use two FTDI devices to talk to each of these.    One I2C device is in the front of my boat the other in the back.  If I always plugged the front FTDI USB device in the same port on the USB hub and the back one also into a particular port could I that way know which device is which and, if so, how can I identify the usb port with the libftdi?  Would this mechanism work even if I plugged and unplugged the devices in at different times, but always to their assigned port.

Any suggestions how to best do this greatly appreciated.


Is this a Linux/Unix system? If so you should be able to use udev to do this for you with a little bit of data collection.

The FTDI devices that I've used have a serial number stored in EEPROM that also shows up in the USB descriptors.
Connect one device at a time and see what device it creates in /dev
Use "udevadm info --name=/dev/SOME_DEVICE --attribute-walk" to see the udev info for your devices which should include
something like this:
ATTRS{serial}=="FTV6IFNT"

With this information, you can write a udev rule to create a symbolic link in /dev that makes them easily identifiable.

Here's an example that use for a system that has an FT230 and a UB232R.
SUBSYSTEM=="tty",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6001",ATTRS{product}=="UB232R",GROUP="plugdev",SYMLINK+="ttyUSB.lcd"

You could try something like this after updating the idProduct, serial, and symlink names as appropriate.

/etc/udev/rules.d/99-i2c-temp-sensors
SUBSYSTEM=="usb",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6001",ATTRS{serial}=="FTV6IFNA",GROUP="plugdev",SYMLINK+="i2c.front.1"
SUBSYSTEM=="usb",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6001",ATTRS{serial}=="FTV6IFNB",GROUP="plugdev",SYMLINK+="i2c.front.2"
SUBSYSTEM=="usb",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6001",ATTRS{serial}=="FTV6IFNC",GROUP="plugdev",SYMLINK+="i2c.back.1"

Setting the group to plugdev is a convenient way to give your user access without requiring root/sudo. You may need to add your user to the group.

Ryan

--

217-351-2655 ext. 126
Distant Focus Corporation
4114B Fieldstone Rd
Champaign, IL 61822
http://jupiter.distantfocus.com/projects/


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   



libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


Current Thread