fixed issue with invalid devices; refs #30

master
Marc Wäckerlin 11 years ago
parent 7f161f70e8
commit f459982d2c
  1. 13
      src/pcsc.hxx

@ -486,13 +486,20 @@ namespace pcsc {
@returns list of readers that contain @c atr in their ATR */
static Strings getReadersWithAtr(const std::string& atr,
Scope s=USER, bool exceptions=true) {
CRYPTOLOG("getting all readers with atr: "<<atr);
Connection c(s, exceptions);
Strings res;
pcsc::Connection::Strings readers(c.scan());
for (pcsc::Connection::Strings::const_iterator it(readers.begin());
it!=readers.end(); ++it)
if (crypto::hex(c.reader(*it)->status().atr).find(atr)!=string::npos)
res.push_back(*it);
it!=readers.end(); ++it)
try {
if (crypto::hex(c.reader(*it)->status().atr).find(atr)
!=string::npos)
CRYPTOLOG("found reader: "<<*it);
res.push_back(*it);
} catch (std::exception& x) { // ignore unusable readers
CRYPTOLOG("ignored unusable reader: "<<x.what());
}
return res;
}

Loading…
Cancel
Save