#ftdi #ffi #usb

sys libftd2xx-ffi

Rust FFI bindings to the FTDI D2XX drivers

7 releases

new 0.2.3 Aug 3, 2020
0.2.2 Jul 30, 2020
0.1.3 Jul 1, 2020
0.1.2 Jun 29, 2020

#131 in Hardware support

Download history 142/week @ 2020-06-25 137/week @ 2020-07-02 118/week @ 2020-07-09 183/week @ 2020-07-16 100/week @ 2020-07-23 201/week @ 2020-07-30

265 downloads per month
Used in libftd2xx

MIT license

58K SLoC

C 32K SLoC // 0.2% comments Shell 15K SLoC // 0.1% comments Rust 10K SLoC // 0.0% comments C++ 2K SLoC // 0.1% comments Automake 146 SLoC // 0.0% comments Pan 5 SLoC

Maintenance crates.io docs.rs Build Status


Rust FFI bindings to the FTDI D2XX drivers.

This crate is just the C bindings. There is a separate crate, libftd2xx, which provides safe wrappers around the unsafe C bindings.


Simply add this crate as a dependency in your Cargo.toml. The static library is distributed in this crate with permission from FTDI.

libftd2xx-ffi = "~0.2.3"

The default feature set will use pre-generated bindings. This is only available for Windows x86_64 and Linux x86_64 platforms.

The bindings can also be generated during compilation using the bindgen feature flag.

libftd2xx-ffi = { version = "~0.2.3", features = ["bindgen"] }

Bindgen has additional dependencies that must be installed in order to compile successfully, see the bindgen requirements page for more details.

Supported Targets

  • x86_64-pc-windows-msvc
  • x86_64-unknown-linux-gnu
  • x86_64-unknown-linux-musl



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.


FTDI provides the D2XX driver as a compiled library and a header file. These files can be found within the vendor directory.

The code within the vendor directory is licensed by FTDI. Please see the Driver License Terms page for their license.

All code outside of the vendor directory is MIT licensed.

Maintainers Notes

README Generation

The README file is generated with cargo-readme.

cargo install cargo-readme
cargo readme > README.md

Pre-generated Bindings

The pre-generated bindings are generated by compiling this crate, then copying the bindings.rs file from the build output.

The Windows bindings were run through dos2unix to normalize line endings and make it easier to diff the generated bindings.

No runtime deps