G'day,
I'm using pcsc-lite to communicate with a smartcard. I have a question
about "card reset" and reconnecting.
I use SCardConnect() to open an exclusive connection to the card. I
perform my operations, then call SCardDisconnect() when done.
But according to the pcsc-lite documentation, the pcsc-lite operations
called between SCardConnect() and SCardDisconnect() can return
SCARD_W_CARD_RESET, which means that the card has been reset by another
application. I assume that SCardReconnect() must be called to
re-establish the connection and continue the operation.
For example, is this how to handle reset:
// Connect to card
SCardConnect(..., &handle, ...);
// Transmit APDU to card, checking for reset connection
while ((ret = SCardTransmit(handle, ...)) == SCARD_W_RESET) {
SCardReconnect(handle, ...);
}
// Disconnect from card
SCardDisconnect(handle);
If I open a connection using SCARD_SHARE_EXCLUSIVE, is it possible for
another application to reset the card before I call SCardDisconnect()?
And what does card reset actually mean anyway? The operations I am
performing between SCardConnect() and SCardDisconnect() involve
selecting files, and verifying the PIN, etc. If another application
resets the card, does this mean that such state information is lost, and
I need to reverify the PIN, reselect the files I was using, etc?
-- Geoff
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle