Browse Source

Make FTDI an opt-in feature

master
Jonas Schievink 2 years ago
parent
commit
34ac5ec180
  1. 6
      .github/workflows/ci.yml
  2. 4
      probe-rs/Cargo.toml
  3. 7
      probe-rs/src/probe/mod.rs

6
.github/workflows/ci.yml

@ -107,6 +107,12 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
- name: Build with default features
uses: actions-rs/cargo@v1
with:
command: build
fmt:
name: Rustfmt

4
probe-rs/Cargo.toml

@ -18,6 +18,8 @@ default = ["builtin-targets"]
# Enable all built in targets.
builtin-targets = []
ftdi = ["libftdi1-sys"]
[dependencies]
log = "0.4.8"
num-traits = "0.2.11"
@ -41,7 +43,7 @@ base64 = "0.12.0"
svg = "0.8.0"
anyhow = "1.0.31"
bitvec = "0.17.4"
libftdi1-sys = { version = "1.0.0-alpha3" }
libftdi1-sys = { version = "1.0.0-alpha3", optional = true }
[build-dependencies]
probe-rs-t2rust = { path = "../probe-rs-t2rust", version ="0.6.0" }

7
probe-rs/src/probe/mod.rs

@ -1,4 +1,5 @@
pub(crate) mod daplink;
#[cfg(feature = "ftdi")]
pub(crate) mod ftdi;
pub(crate) mod jlink;
pub(crate) mod stlink;
@ -175,7 +176,10 @@ impl Probe {
/// should be used.
pub fn list_all() -> Vec<DebugProbeInfo> {
let mut list = daplink::tools::list_daplink_devices();
list.extend(ftdi::list_ftdi_devices());
#[cfg(feature = "ftdi")]
{
list.extend(ftdi::list_ftdi_devices());
}
list.extend(stlink::tools::list_stlink_devices());
list.extend(list_jlink_devices().expect("Failed to list J-Link devices."));
@ -192,6 +196,7 @@ impl Probe {
Err(DebugProbeError::ProbeCouldNotBeCreated(ProbeCreationError::NotFound)) => {}
Err(e) => return Err(e),
};
#[cfg(feature = "ftdi")]
match ftdi::FtdiProbe::new_from_selector(selector.clone()) {
Ok(link) => return Ok(Probe::from_specific_probe(link)),
Err(DebugProbeError::ProbeCouldNotBeCreated(ProbeCreationError::NotFound)) => {}

Loading…
Cancel
Save