Changeset 3483

Show
Ignore:
Timestamp:
04/20/08 23:23:26 (7 months ago)
Author:
alonbl
Message:

Handle SCARD_E_INVALID_HANDLE at pcsc_lock

Location:
branches/alonbl/pnp/src/libopensc
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/alonbl/pnp/src/libopensc/internal-winscard.h

    r3460 r3483  
    5252 
    5353#define SCARD_S_SUCCESS                 0x00000000 /**< No error was encountered. */ 
     54#define SCARD_E_INVALID_HANDLE          0x80100003 /**< The supplied handle was invalid. */ 
    5455#define SCARD_E_TIMEOUT                 0x8010000A /**< The user-specified timeout value has expired. */ 
    5556#define SCARD_E_SHARING_VIOLATION       0x8010000B /**< The smart card cannot be accessed because of other connections outstanding. */ 
  • branches/alonbl/pnp/src/libopensc/reader-pcsc.c

    r3481 r3483  
    645645        rv = priv->gpriv->SCardBeginTransaction(pslot->pcsc_card); 
    646646 
     647        if ((unsigned int)rv == SCARD_E_INVALID_HANDLE) { 
     648                rv = pcsc_connect(reader, slot); 
     649                if (rv != SCARD_S_SUCCESS) { 
     650                        PCSC_ERROR(reader->ctx, "SCardConnect failed", rv); 
     651                        return pcsc_ret_to_error(rv); 
     652                } 
     653/* STRANGE-BEGIN */ 
     654rv = priv->gpriv->SCardEndTransaction(pslot->pcsc_card, SCARD_RESET_CARD); 
     655                /* Now try to begin a new transaction after we reconnected and we fail if 
     656                 some other program was faster to lock the reader */ 
     657/*              rv = priv->gpriv->SCardBeginTransaction(pslot->pcsc_card); 
     658 */ 
     659/* STRANGE-END */ 
     660        } 
     661 
    647662        if ((unsigned int)rv == SCARD_W_RESET_CARD) { 
    648663                /* try to reconnect if the card was reset by some other application */