Add FTDI MPSSE programmer support with multiple backends#19
Merged
ArthurHeymans merged 5 commits intomasterfrom Feb 9, 2026
Merged
Add FTDI MPSSE programmer support with multiple backends#19ArthurHeymans merged 5 commits intomasterfrom
ArthurHeymans merged 5 commits intomasterfrom
Conversation
Add optional native Rust FTDI backend using rs-ftdi crate as an alternative to C libftdi1 bindings. Introduces `ftdi-native` and `all-programmers-native` feature flags to enable pure-Rust FTDI MPSSE implementation backed by nusb. - Add native_device and native_error modules with same public API - Implement FtdiDevice wrapper using rs-ftdi for MPSSE operations - Add feature flags for build-time backend selection - Maintain backward compatibility with existing libftdi1 backend Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
…icate FtdiConfig Add a WebUSB backend for the FTDI MPSSE programmer using nusb with maybe_async, following the same pattern as CH341A and CH347 WASM implementations. Integrates into the web UI with device type, channel, and SPI clock selection. Fix a bug in the SFDP parser where EraseBlock::new() created all erase types with count=1, causing them to be misclassified as chip erase operations. This made erase fail with InvalidAlignment for any chip not in the database. Use EraseBlock::with_count() with the correct count derived from chip density. Extract the triplicated FtdiConfig struct into protocol.rs as a single shared definition. Add From<String> to all FtdiError types to bridge the config validation errors. Filter the WASM channel selector based on device_type.channel_count().
Merge the separate native_device.rs and wasm_device.rs into a single rsftdi_device.rs using maybe-async for compile-time sync/async selection. Remove the now-redundant wasm_device.rs and wasm_error.rs files. Update lib.rs module routing and Cargo.toml dependencies (add rs-ftdi git dep with WASM branch, js-sys, wasm-bindgen, web-sys for WebUSB support).
…fg gates When --all-features is enabled (as in CI), both 'native' and 'wasm' features are active simultaneously. Using not(feature = "wasm") to guard native-only code caused parse_options, Ftdi::open, and FtdiDeviceInfo to be excluded on native targets. Switch to not(target_arch = "wasm32") so native code compiles correctly regardless of which features are enabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive FTDI MPSSE programmer support with three different backends to support various deployment scenarios:
Key Changes
Three Backend Implementations
stdbackend (default): Uses C libftdi1 bindings via theftdicratenativebackend: Pure-Rust implementation usingrs-ftdi+nusbwasmbackend: WebUSB support for browser use vianusb+maybe_asyncAll three backends share the same public API and protocol definitions, making them interchangeable based on feature flags.
FTDI Device Support
Implementation Details
WASM Integration
maybe_asyncBug Fixes
From<String>implementation for error type conversionsConfiguration
ftdi-nativefeature to use pure-Rust backend instead of C libftdi1all-programmers-nativefeature set for all-Rust builds