From 405a2a1fc17637aa2463e1c1be13862d0586c32d Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Sun, 16 Jan 2022 21:43:12 +0100 Subject: [PATCH] Don't fail when a card errors on "get DO ARD", we could still find the card we're looking for --- pcsc/src/lib.rs | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/pcsc/src/lib.rs b/pcsc/src/lib.rs index 547e407..108e323 100644 --- a/pcsc/src/lib.rs +++ b/pcsc/src/lib.rs @@ -292,28 +292,35 @@ impl PcscClient { // -- /debug: status -- if let Some(ident) = ident { - let ard = PcscTxClient::application_related_data( - &mut txc, - )?; - let aid = ard.application_id()?; + if let Ok(ard) = + PcscTxClient::application_related_data( + &mut txc, + ) + { + let aid = ard.application_id()?; - if aid.ident() == ident.to_ascii_uppercase() { - // FIXME: handle multiple cards with matching ident - log::debug!( + if aid.ident() == ident.to_ascii_uppercase() { + // FIXME: handle multiple cards with matching ident + log::debug!( "open_by_ident: Opened and selected {:?}", ident ); - // we want to return this one card - store_card = true; - } else { - log::debug!( + // we want to return this one card + store_card = true; + } else { + log::debug!( "open_by_ident: Found, but won't use {:?}", aid.ident() ); - // FIXME: end transaction - // txc.end(); + // FIXME: end transaction + // txc.end(); + } + } else { + // couldn't read ARD for this card ... + // ignore and move on + continue; } } else { // we want to return all cards