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.
toml
[dependencies]
libftd2xx-ffi = "~0.2.0"
The default feature set will use pre-generated bindings. This is only available for Windows x8664 and Linux x8664 platforms.
The bindings can also be generated during compilation using the [bindgen]
feature flag.
toml
[dependencies]
libftd2xx-ffi = { version = "~0.2.0", features = ["bindgen"] }
Bindgen has additional dependencies that must be installed in order to compile successfully, see the [bindgen requirements] page for more details.
From the [Rust Edition Guide].
By default, Rust will statically link all Rust code. However, if you use the standard library, it will dynamically link to the system's
libc
implementation. If you'd like a 100% static binary, theMUSL libc
can be used on Linux.
On Linux I have found that compiling with
--target x86_64-unknown-linux-musl
can significantly improve runtime performance with this crate.
Remove the VCP FTDI driver.
bash
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 libftd2xx_src
directory.
The code within the libftd2xx_src
directory is licensed by FTDI.
Please see the [Driver License Terms] page for their license.
All code outside of the libftd2xx_src
directory is MIT licensed.
The README file is generated with [cargo-readme].
bash
cargo install cargo-readme
cargo readme > README.md
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.