pyftdi: FTDI Device Driver

0.57.1 · active · verified Mon Apr 13

pyftdi is a pure Python driver for FTDI devices, providing access to their various functionalities including USB-to-serial, SPI, I2C, and GPIO. It acts as a wrapper around the `libftdi` C library, enabling cross-platform control of FTDI-based hardware. The current version is 0.57.1, with an active development cadence supporting recent Python versions.

Warnings

Install

Imports

Quickstart

This quickstart code demonstrates how to scan and list all detected FTDI devices connected to your system. It is a common first step to verify the `pyftdi` installation and device connectivity without requiring specific device URLs or complex operations. It relies on the underlying `libftdi` C library.

from pyftdi.ftdi import Ftdi

def list_ftdi_devices():
    """
    Scans and lists available FTDI devices.
    Requires 'libftdi' to be installed on the system and appropriate
    USB permissions.
    """
    print("Scanning for FTDI devices...")
    try:
        # Ftdi.show_devices() prints detected devices to stdout
        Ftdi.show_devices()
        print("\nIf no devices are listed, ensure they are connected,")
        print("libftdi is installed, and USB permissions are correct.")
    except Exception as e:
        print(f"Error scanning for devices: {e}")
        print("Ensure 'libftdi' is installed and USB permissions are set correctly.")

if __name__ == "__main__":
    list_ftdi_devices()

view raw JSON →