Treat pcsc::Error::NoSmartcard as a "YubiKey disconnected" error

Some SmartCard readers report this error when no SmartCard is inserted,
so we need to check for it when filtering for connected YubiKeys (along
with `pcsc::Error::RemovedCard` which some _other_ SmartCard readers
report instead).

Closes str4d/age-plugin-yubikey#81.
This commit is contained in:
Jack Grigg
2023-01-29 14:27:20 +00:00
parent a5178bb16e
commit ff3e8e37c9
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ pub(crate) fn is_connected(reader: Reader) -> bool {
pub(crate) fn filter_connected(reader: &Reader) -> bool {
match reader.open() {
Err(yubikey::Error::PcscError {
inner: Some(pcsc::Error::RemovedCard),
inner: Some(pcsc::Error::NoSmartcard | pcsc::Error::RemovedCard),
}) => {
warn!(
"{}",