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(()) }