Skip to content

Add utility to list all FTDI devices connected via USB

Daniel Joseph Antrim requested to merge dantrim/labRemote:add_ftdi_list into devel

What

This MR adds the utility ftdi_list which the user can call to list detailed information about any FTDI devices connected to their PC. It uses ftdi_usb_find_all to search for the FTDI devices. The user can provide specific USB vendor and product id pairs at the command line to tell ftdi_usb_find_all to only search for those FTDI devices with those USB identifiers. If the user does not provide this information, ftdi_usb_find_all will find all FTDI devices.

With those FTDI devices found above, ftdi_list will inspect the found devices' identifier strings (manufacturer, description, and serial number strings) and print them to the screen for each device found. These identifier strings are defined in the FTDI devices' EEPROMs. If these fields are not filled in in the EEPROM, then these fields will be returned as empty strings '""', which indicates to the caller of ftdi_list that these fields need to be set. They can be set with the ftdi_setidentity utility of !162 (merged).

The MR also adds a Findlibusb-1.0.cmake file. In principle, if the user was able to successfully install libmpsse and libftdi, they should have libusb-1.0 -- however, there are some instances of directly using libusb-1.0 library methods in ftdi_list and it needs to link against libusb-1.0 directly in order to compile.

Example Usage

Without providing any command line parameters or options, ftdi_list will list all found FTDI devices:

./bin/ftdi_list
[INFO]    : Found 3 USB device(s) matching 0x0000:0x0000
[INFO]    : Device #0 0x0403:0x6014
[INFO]    :     MANUFRACTURER ID : dantrim
[INFO]    :     PRODUCT ID       : SCCAnalogMonitor
[INFO]    :     SERIAL NUMBER    : beef0001
[INFO]    : Device #1 0x0403:0x6014
[INFO]    :     MANUFRACTURER ID : dantrim
[INFO]    :     PRODUCT ID       : SCCAnalogMonitor
[INFO]    :     SERIAL NUMBER    : beef0002
[INFO]    : Device #2 0x1234:0x5678
[INFO]    :     MANUFRACTURER ID : foobar
[INFO]    :     PRODUCT ID       : bazbeef
[INFO]    :     SERIAL NUMBER    : ee1234dd

Providing the product and vendor ID at the command line will only search out those FTDI devices matching those identifiers:

./bin/ftdi_list 403:6014
[INFO]    : Found 2 USB device(s) matching 0x0403:0x6014
[INFO]    : Device #0 0x0403:0x6014
[INFO]    :     MANUFRACTURER ID : dantrim
[INFO]    :     PRODUCT ID       : SCCAnalogMonitor
[INFO]    :     SERIAL NUMBER    : beef0001
[INFO]    : Device #1 0x0403:0x6014
[INFO]    :     MANUFRACTURER ID : dantrim
[INFO]    :     PRODUCT ID       : SCCAnalogMonitor
[INFO]    :     SERIAL NUMBER    : beef0002

With this information, and MR !162 (merged), the user will know the identification strings required for connecting to a specific FTDI device connected to there machine, if there are multiple.

Requirements

This MR requires that the FTDI device's identification strings have been set in the device's EEPROM. This is achieved by the ftdi_setidentity utility provided for in MR !162 (merged).

Edited by Daniel Joseph Antrim

Merge request reports