Monthly Archives: December 2016

Installing libftdi – Libraries from source

Brief log of installing libftdi:

Find the libftdi repository (Thanks intra2net!)

git clone git://developer.intra2net.com/libftdi
cd libftdi
git checkout v1.3 or whichever version you are aiming for.

You can cat the README for the install instructions, happily it uses a typical CMAKE structure.
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX="/usr" ../ to set the install path if you want to install it
make; sudo make install

This sets up the binaries and headers where you need them. You may want to update ldconfig immediately and check your install:
sudo ldconfig; ldconfig -p |grep libftdi

go and grab the example code from the documentation
The install process as described puts the header at “libftdi1/ftdi.h” so fix that in the code
gcc example.c -lftdi1 -oexample_ftdi
the linker automatically prepends the “lib” to ftdi1 when it searches the files, see this in action with:
ld -lftdi --verbose

Libftdi reminds you to unload the stock ftdi driver in the kernel for proper operation:
sudo modprobe -r ftdi_sio

This is yet another scenario where direct access to the usb device typically requires permission elevation. rather than running the app with sudo every single time, we can designate this particular device (the FTDI 2232H chip) as having read/write permissions from any user. the 2232H has a device ID of 0403:6010

add to /etc/udev/rules.d/48-ftdi2232h.rules

# ftdi 2232h devices on the digilent CMOD A7 devboard

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", \
MODE:="0666"

# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.