#ftdi #usb

libftd2xx

Rust safe wrapper around the libftd2xx-ffi crate

27 releases (16 breaking)

0.17.0 Sep 13, 2020
0.16.0 Aug 25, 2020
0.7.1 Jul 27, 2020

#39 in Hardware support

Download history 7/week @ 2020-06-23 39/week @ 2020-06-30 35/week @ 2020-07-07 75/week @ 2020-07-14 54/week @ 2020-07-21 63/week @ 2020-07-28 50/week @ 2020-08-04 119/week @ 2020-08-11 82/week @ 2020-08-18 79/week @ 2020-08-25 64/week @ 2020-09-01 84/week @ 2020-09-08 15/week @ 2020-09-15

242 downloads per month
Used in 2 crates (via ftd2xx-embedded-hal)

MIT license

155KB
2.5K SLoC

Maintenance crates.io docs.rs Build Status

libftd2xx

Rust safe wrapper for the FTDI D2XX drivers.

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

Usage

Simply add this crate as a dependency in your Cargo.toml. On Linux the static library is distributed in the libftd2xx-ffi crate with permission from FTDI.

[dependencies]
libftd2xx = "~0.17.0"

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

One-time Linux Setup

To access the FTDI USB device as a regular user you need to update the udev rules.

Create a file called /etc/udev/rules.d/99-ftdi.rules with:

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6011", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6014", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6015", GROUP="dialout", MODE="0664"

Then, reload the rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

You will also need to be part of the dialout group:

sudo adduser "$USER" dialout

One-time Windows Setup

Unlike Linux the Windows vendor driver is dynamically linked. The FTD2XX DLL must exist on your system PATH. The easiest way to install this is with the vendor provided setup executable.

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.

Dependencies

~1MB
~12K SLoC