Update to match firmware's expectation of name

This commit is contained in:
shylie 2026-01-08 13:25:28 -05:00
parent cd9d3f4f0d
commit 8b17d1a9ca

View File

@ -58,12 +58,6 @@ impl Display for Error {
}
fn main() -> Result<(), Error> {
let args: Vec<String> = env::args().collect();
let img = image::open(&args[1])?;
let img = img.crop_imm(28, 28, img.width() - 56, img.height() - 56);
let img = img.resize_exact(240, 320, FilterType::Gaussian);
let img = img.into_rgb8();
let device = list_devices().wait()?
.find(|dev| dev.vendor_id() == 0xCAFE && dev.product_id() == 0xCA6D)
.ok_or(Error { message: "Device not found" })?;
@ -73,8 +67,23 @@ fn main() -> Result<(), Error> {
let mut writer = interface.endpoint::<Bulk, Out>(0x01)?.writer(4096);
writer.write_all(img.as_flat_samples().samples)?;
writer.flush()?;
let args: Vec<String> = env::args().collect();
if args.len() == 1 {
writer.write(&[0x42])?;
writer.flush()?;
} else {
// name of card
writer.write(&[0])?;
let img = image::open(&args[1])?;
let img = img.crop_imm(28, 28, img.width() - 56, img.height() - 56);
let img = img.resize_exact(240, 320, FilterType::Gaussian);
let img = img.into_rgb8();
// image of card
writer.write_all(img.as_flat_samples().samples)?;
writer.flush()?;
}
Ok(())
}