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