Skip to content

Commit d40e6d7

Browse files
committed
i2cdev: Verify with get_mode() that we have the correct bus/address
Signed-off-by: Janne Grunau <[email protected]>
1 parent 143b904 commit d40e6d7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/cd321x.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ impl Device {
8989
i2c: verify_i2c_device(bus, address)?,
9090
key: code.into_bytes().into_iter().rev().collect::<Vec<u8>>(),
9191
};
92+
if device.get_mode()? != TpsMode::App {
93+
return Err(Error::TypecController);
94+
}
9295
device.lock(device.key.clone().as_slice())?;
9396
device.dbma(true)?;
9497

0 commit comments

Comments
 (0)