Fix ectool command_finish

This commit is contained in:
Jeremy Soller 2020-02-20 15:01:40 -07:00
parent 08490002b9
commit 346775b941
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1

View File

@ -83,12 +83,12 @@ impl<T: Timeout> Ec<T> {
/// Finish an EC command
pub unsafe fn command_finish(&mut self) -> Result<(), Error> {
if self.can_command() {
Err(Error::WouldBlock)
} else {
match self.read(1) {
0 => Ok(()),
err => Err(Error::Protocol(err)),
}
} else {
Err(Error::WouldBlock)
}
}