diff --git a/Cargo.toml b/Cargo.toml index 6444bfd..eef7280 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cargo-dfu" authors = ["Roman Kretschmer "] -version = "0.1.0" +version = "0.1.1" edition = "2021" description = "cargo extension for flashing embedded rust programs via dfu" license = "MIT" @@ -18,8 +18,8 @@ goblin = "0.2.3" colored = "2.0.0" rusb = "0.9.0" pretty_env_logger = "0.3.0" -cargo-project = "0.2.4" +cargo-project = "0.2.7" clap = {version = "3.0.10", features=["derive"]} maplit = "1.0.2" log = "0.4.6" -dfu-libusb = "0.2.0" +dfu-libusb = "0.2.1" diff --git a/src/utils.rs b/src/utils.rs index 4655032..6fe9226 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -64,17 +64,7 @@ pub fn flash_bin(binary: &[u8], d: &rusb::Device) -> Result<(), U ) .map_err(|e| UtilError::Dfu(e))?; - std::fs::write("target/out.bin", binary).map_err(|e| UtilError::File(e))?; - dfu.download( - &mut std::fs::OpenOptions::new() - .read(true) - .open("target/out.bin") - .map_err(|e| UtilError::File(e))?, - std::fs::metadata("target/out.bin") - .map_err(|e| UtilError::File(e))? - .len() as u32, - ) - .unwrap(); + dfu.download_from_slice(binary).unwrap(); Ok(()) }