#ftdi #usb-device #usb #api-bindings


Rust safe wrapper around the libftd2xx-ffi crate

49 releases (31 breaking)

0.32.4 Mar 5, 2024
0.32.3 Oct 19, 2023
0.32.2 Dec 14, 2022
0.32.1 Aug 28, 2022
0.7.1 Jul 27, 2020

#40 in Hardware support

Download history 733/week @ 2024-03-13 631/week @ 2024-03-20 606/week @ 2024-03-27 869/week @ 2024-04-03 623/week @ 2024-04-10 594/week @ 2024-04-17 509/week @ 2024-04-24 667/week @ 2024-05-01 783/week @ 2024-05-08 698/week @ 2024-05-15 772/week @ 2024-05-22 271/week @ 2024-05-29 403/week @ 2024-06-05 326/week @ 2024-06-12 507/week @ 2024-06-19 219/week @ 2024-06-26

1,510 downloads per month
Used in 21 crates (10 directly)

MIT license

2.5K SLoC

crates.io docs.rs CI


Rust safe wrapper for the FTDI D2XX drivers.

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


Simply add this crate as a dependency in your Cargo.toml.

version = "0.32.4"
# statically link the vendor library, defaults to dynamic if not set
# this will make things "just work" on Linux and Windows
features = ["static"]

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);

This crate is just a wrapper around the FTD2XX driver; I2C, SPI, and GPIO examples using the embedded-hal traits can be found in ftdi-embedded-hal.

udev rules

To access the FTDI USB device as a regular user on Linux 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


By default this crate with use dynamic linking for the vendor library. Use the static feature flag to enable static linking.

Dynamic Linking on Linux

The shared object libftd2xx.so must exist on your system. See FTDI Drivers Installation Guide for Linux for instructions.

Dynamic Linking on Windows

The FTD2XX DLL must exist on your system PATH. The easiest way to install this is with the vendor provided setup executable.

Static Linking on Linux or Windows

No special considerations are needed, the static library is distributed with permission from FTDI in the libftd2xx-ffi crate.



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.


~73K SLoC