Get pcsc card via PcscClient::open_by_ident(), instead of manually filtering it from a list of all cards.

This commit is contained in:
Heiko Schaefer 2021-12-12 21:50:30 +01:00
parent f312ce94f7
commit 9a3b47f0fa
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

View file

@ -97,19 +97,7 @@ impl TestCard {
let res = ScdClient::shutdown_scd(None); let res = ScdClient::shutdown_scd(None);
log::trace!(" Attempt to shutdown scd: {:?}", res); log::trace!(" Attempt to shutdown scd: {:?}", res);
for mut ca in PcscClient::cards()? { Ok(PcscClient::open_by_ident(ident)?)
// Set Card Capabilities (chaining, command length, ..)
let ard = ca.application_related_data()?;
let app_id = ard.application_id()?;
if app_id.ident().as_str() == ident.to_uppercase() {
// println!("opened pcsc card {}", ident);
return Ok(ca);
}
}
Err(anyhow!("Pcsc card {} not found", ident))
} }
Self::Scdc(serial) => { Self::Scdc(serial) => {
// println!("open scdc card {}", serial); // println!("open scdc card {}", serial);