Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status code 6285 #11

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/response/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum Status {
///////////////////////////////

// 62XX: state of non-volatile memory unchanged (cf. SW2)
SelectedFileInTerminationState,

// 63XX: state of non-volatile memory changed (cf. SW2)
VerificationFailed,
Expand Down Expand Up @@ -86,6 +87,8 @@ impl TryFrom<(u8, u8)> for Status {
fn try_from(sw: (u8, u8)) -> Result<Self, Self::Error> {
let (sw1, sw2) = sw;
Ok(match u16::from_be_bytes([sw1, sw2]) {
0x6285 => Self::SelectedFileInTerminationState,

0x6300 => Self::VerificationFailed,
sw @ 0x63c0..=0x63cf => Self::RemainingRetries((sw as u8) & 0xf),

Expand Down Expand Up @@ -125,6 +128,7 @@ impl From<Status> for u16 {
fn from(status: Status) -> u16 {
use Status::*;
match status {
SelectedFileInTerminationState => 0x6285,
VerificationFailed => 0x6300,
RemainingRetries(x) => {
assert!(x < 16);
Expand Down