Skip to content
Snippets Groups Projects
Commit 058814fc authored by Samuel Tardieu's avatar Samuel Tardieu
Browse files

Be more explicit with a I²C bus opening problem

parent 0041d81d
No related branches found
No related tags found
1 merge request!56Stay in control mode at (0, 0) speed
......@@ -16,6 +16,8 @@ mod elf_loader;
#[derive(Debug, thiserror::Error)]
enum Error {
#[error("cannot open I²C bus /dev/i2c-{bus}")]
OpenI2c { source: i2c::Error, bus: u8 },
#[error(transparent)]
RawI2c(#[from] i2c::Error),
#[error(transparent)]
......@@ -142,7 +144,10 @@ fn cmd_flash(args: &FlashArgs) -> Result<()> {
}
// Switch to bootloader mode
let mut i2c = I2c::with_bus(args.i2c_bus)?;
let mut i2c = I2c::with_bus(args.i2c_bus).map_err(|source| Error::OpenI2c {
source,
bus: args.i2c_bus,
})?;
let program = if args.skip_firmware_version_check {
ActiveProgram::Controller {
version: Version::parse("0.0.0").unwrap(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment