diff --git a/Cargo.lock b/Cargo.lock index f96e945..2b88baa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,7 +72,7 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cargo-dfu" -version = "0.0.4" +version = "0.1.1" dependencies = [ "cargo-project", "clap", @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "dfu-core" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b82ffc1790e4af9371dbc3399c6c068a3ee506357632e21eb7111df199c59f3" +checksum = "00fab7382221c801db4853a1ff338bb1281e8f2f9b456e888793fef61c4d890c" dependencies = [ "bytes", "displaydoc", diff --git a/Cargo.toml b/Cargo.toml index 6444bfd..f9f5836 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,7 +18,7 @@ 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" 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(()) }