//
// Construct a Reader
// This does not commence state tracking; call update to start up the reader.
//
Reader::Reader(TokenCache &tc, const PCSC::ReaderState &state)
	: cache(tc), mType(pcsc), mToken(NULL)
{
	mName = state.name();	// remember separate copy of name
	mPrintName = mName;		//@@@ how to make this readable? Use IOKit information?
	secdebug("reader", "%p (%s) new PCSC reader", this, name().c_str());
}
Example #2
0
void Connection::open(const PCSC::ReaderState &reader, unsigned share)
{
	// fill in the minimum needed to identify the card
	MSCTokenInfo info;
	
	// set slot name in info
	strncpy(info.slotName, reader.name(), MAX_READERNAME);
	
	// set ATR in info
	assert(reader.length() <= MAX_ATR_SIZE);
	memcpy(info.tokenId, reader.data(), reader.length());
	info.tokenIdLength = (MSCULong32)reader.length();
	
	// establish Muscle-level connection to card
	Error::check(::MSCEstablishConnection(&info, share, NULL, 0, this));
	mIsOpen = true;
	secdebug("muscle", "%p opened %s", this, info.slotName);
	
	// pull initial status
	updateStatus();
}