libftd2xx 0.24.1

Rust safe wrapper around the libftd2xx-ffi crate.
Documentation

Maintenance crates.io docs.rs CI

libftd2xx

Rust safe wrapper for the FTDI D2XX drivers.

This takes the libftd2xx-ffi C bindings crate and extends it with rust safe wrappers.

Usage

Simply add this crate as a dependency in your Cargo.toml. On Linux the static library is distributed in the libftd2xx-ffi crate with permission from FTDI.

[dependencies]
libftd2xx = "~0.24.1"

This is a basic example to get your started. Check the source code or documentation for more examples.

use libftd2xx::{Ftdi, FtdiCommon};

let mut ft = Ftdi::new()?;
let info = ft.device_info()?;
println!("Device information: {:?}", info);

One-time Linux Setup

To access the FTDI USB device as a regular user you need to update the udev rules.

Create a file called /etc/udev/rules.d/99-ftdi.rules with:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0666"

Then, reload the rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

One-time Windows Setup

Unlike Linux the Windows vendor driver is dynamically linked. The FTD2XX DLL must exist on your system PATH. The easiest way to install this is with the vendor provided setup executable.

References

Troubleshooting

Unknown Device on Linux

Remove the VCP FTDI driver.

sudo rmmod ftdi_sio
sudo rmmod usbserial

See FTDI Drivers Installation Guide for Linux for more details.