#usb-device #usb #ftdi

sys libftd2xx-ffi

Rust FFI bindings to the FTDI D2XX drivers

22 releases

0.8.7 Dec 1, 2024
0.8.6 Nov 28, 2022
0.8.5 Sep 17, 2022
0.8.4 Aug 15, 2021
0.2.2 Jul 30, 2020

#1185 in Hardware support

Download history 623/week @ 2024-08-19 723/week @ 2024-08-26 795/week @ 2024-09-02 638/week @ 2024-09-09 621/week @ 2024-09-16 950/week @ 2024-09-23 959/week @ 2024-09-30 587/week @ 2024-10-07 693/week @ 2024-10-14 568/week @ 2024-10-21 754/week @ 2024-10-28 415/week @ 2024-11-04 617/week @ 2024-11-11 788/week @ 2024-11-18 707/week @ 2024-11-25 1399/week @ 2024-12-02

3,545 downloads per month
Used in 25 crates (via libftd2xx)

Custom license

7.5MB
77K SLoC

Contains (static library, 700KB) vendor/windows/Static/amd64/ftd2xx.lib, (static library, 575KB) vendor/windows/Static/i386/ftd2xx.lib, (static library, 385KB) vendor/linux/armv6-hf/build/libftd2xx.a, (ELF exe/lib, 370KB) libftd2xx.so.1.4.24, (static library, 295KB) vendor/linux/armv7-hf/build/libftd2xx.a, (ELF exe/lib, 275KB) libftd2xx.so.1.4.24 and 17 more.

crates.io docs.rs CI

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.

[dependencies]
libftd2xx-ffi = "~0.8.7"

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.

[dependencies]
libftd2xx-ffi = { version = "~0.8.7", features = ["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.

[dependencies]
libftd2xx-ffi = { version = "~0.8.7", features = ["static"] }

Static linking may be preferred, however there may be license incompatibilities (static linking with GPL code). If in doubt, check the FTDI driver license terms.

Supported Targets

Tested Targets

  • aarch64-unknown-linux-gnu (dynamic + static)
  • aarch64-unknown-linux-musl (static)
  • 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.

  • arm-unknown-linux-gnueabihf (dynamic + static)
  • arm-unknown-linux-musleabihf (static)
  • armv7-unknown-linux-gnueabihf (dynamic + static)
  • armv7-unknown-linux-musleabihf (static)
  • x86_64-apple-darwin (dynamic)
  • aarch64-apple-darwin (dynamic)
  • aarch64-pc-windows-msvc (dynamic)

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.

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.

Dependencies