libftd2xx-ffi
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.
Usage
Simply add this crate as a dependency in your Cargo.toml
.
The static library is distributed in this crate with permission from FTDI.
The default feature set will use dynamic linking.
[]
= "~0.7.0"
Bindgen
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.
[]
= { = "~0.7.0", = ["bindgen"] }
Bindgen has additional dependencies that must be installed in order to compile successfully, see the bindgen requirements page for more details.
Static Linking
Static linking the FTD2XX library into this crate can be done by using the static feature flag.
[]
= { = "~0.7.0", = ["static"] }
For GNU/Linux users, no further work is needed. Technically this may be preferred, however there may be license incompatibilities (static linking with GPL code). If in doubt, check the FTDI driver license terms.
On Windows, we rely on MSVC and a manually set "LIBMSVC_PATH" environment variable. For example a possible 2019 Community installation path may be:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\lib\
This brings in legacy_stdio_definitions.lib
and user32.lib
.
It seems to play nicely with rust, but you may end up with multiple defined
symbol errors if using this crate as a c/c++ dependency.
Supported Targets
Tested Targets
i686-pc-windows-msvc
(dynamic + static)i686-unknown-linux-gnu
(dynamic + static)i686-unknown-linux-musl
(static)x86_64-pc-windows-msvc
(dynamic + static)x86_64-unknown-linux-gnu
(dynamic + static)x86_64-unknown-linux-musl
(static)
Untested Targets
These targets are provided, but they are untested. Use at your own risk.
aarch64-unknown-linux-gnu
(dynamic + static)aarch64-unknown-linux-musl
(dynamic + static)arm-unknown-linux-gnueabihf
(dynamic + static)arm-unknown-linux-musleabihf
(dynamic + static)armv7-unknown-linux-gnueabihf
(dynamic + static)armv7-unknown-linux-musleabihf
(dynamic + static)i686-unknown-linux-musl
(dynamic)x86_64-unknown-linux-musl
(dynamic)
References
Troubleshooting
Unknown Device on Linux
Remove the VCP FTDI driver.
See FTDI Drivers Installation Guide for Linux for more details.
License
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.
Note: This crate is not affiliated with FTDI. You will need to contact the vendor for any support requests with the underlying library because it is closed source.