mirror of
https://github.com/gnxlxnxx/cargo-dfu.git
synced 2026-07-27 15:23:02 +02:00
remove address
dfu-libusb does that internally so I don't need to specify that here
This commit is contained in:
+2
-4
@@ -137,14 +137,12 @@ fn main() {
|
||||
|
||||
println!(" {} {:?}", "Flashing".green().bold(), path);
|
||||
|
||||
let (binary, address) = elf_to_bin(path).unwrap();
|
||||
let (binary, _) = elf_to_bin(path).unwrap();
|
||||
|
||||
// Start timer.
|
||||
let instant = Instant::now();
|
||||
|
||||
// let bininfo = hf2::bin_info(&d).expect("bin_info failed");
|
||||
// log::debug!("{:?}", bininfo);
|
||||
flash_bin(&binary, address, &d.device()).unwrap();
|
||||
flash_bin(&binary, &d.device()).unwrap();
|
||||
|
||||
// Stop timer.
|
||||
let elapsed = instant.elapsed();
|
||||
|
||||
+1
-5
@@ -54,11 +54,7 @@ pub fn elf_to_bin(path: PathBuf) -> Result<(Vec<u8>, u32), UtilError> {
|
||||
Ok((data, start_address as u32))
|
||||
}
|
||||
|
||||
pub fn flash_bin(
|
||||
binary: &[u8],
|
||||
address: u32,
|
||||
d: &rusb::Device<GlobalContext>,
|
||||
) -> Result<(), UtilError> {
|
||||
pub fn flash_bin(binary: &[u8], d: &rusb::Device<GlobalContext>) -> Result<(), UtilError> {
|
||||
let mut dfu = dfu_libusb::DfuLibusb::open(
|
||||
&rusb::Context::new().unwrap(),
|
||||
d.device_descriptor().unwrap().vendor_id(),
|
||||
|
||||
Reference in New Issue
Block a user