Hi,

opensc (reader-pcsc.c) uses the following code to determine that a smartcard 
was removed and (another card) inserted again:


                /* If we aren't sure if the card state changed, check if
                 * the card handle is still valid. If the card changed,
                 * the handle will be invalid. */
                slot->flags &= ~SC_SLOT_CARD_CHANGED;
                if (maybe_changed) {
                        if (old_flags & SC_SLOT_CARD_PRESENT) {
                                DWORD readers_len = 0, state, prot, atr_len = 
32;
                                unsigned char atr[32];
                                LONG rv = SCardStatus(pslot->pcsc_card, NULL, 
&readers_len,
                                        &state, &prot, atr, &atr_len);
                                if (rv == (LONG)SCARD_W_REMOVED_CARD)
                                        slot->flags |= SC_SLOT_CARD_CHANGED;
                        }
                        else
                                slot->flags |= SC_SLOT_CARD_CHANGED;



On Windows, SCardStatus (realised by MS) returns SCARD_W_REMOVED_CARD, and 
everything is fine. On Linux, SCardStatus (realised by pcsc-lite) returns 
SCARD_W_RESET_CARD. Does anybody have an idea which implementation "is right"? 
Is it an issue of pcsc (return SCARD_W_REMOVED_CARD in any case), or opensc 
which has to evaluate both (or maybe even other) returncodes?


Here is my environment:

Windows:

SPR 532 Cardreader, vendor supplied PC/SC-Driver for Windows, opensc, 
engine-pkcs11, openssl

Linux:

SPR 532 Cardreader, pcsc-lite using vendor supplied PC/SC-Driver for Linux, 
opensc, engine-pkcs11, openssl


Greetings,

Stefan Blomen
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to