On Mon, Sep 15, 2014 at 9:18 AM, Ignacio Casal <[email protected]> wrote: > > Hey guys, > > do you know what is the proper way to detect when a smart card is inserted? > ... > > As you can see I need to do the call twice, first to get the current state > and second to actually block to wait for the smart card to be inserted. Is > this second way the recommended way also on pcsclite? If yes is the first > version shown here in this mail some kind of shortcut for the 2 way call? > Is there a better way to check when a smart card is inserted?
The easiest and less elegant way is to use only SCardConnect in a loop (with a delay like 200ms) until it returns OK. It may not look beautiful but works anywhere. Some may argue that in a shared environment with multiple smart card software running this would not work because one of the programs could lock the card. In this case SCardConnect will return SCARD_E_SHARING_VIOLATION so you still know there is a card. > Thanks in advance. > > -- > Ignacio Casal Quinteiro Best regards, Bruno _______________________________________________ Pcsclite-muscle mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle
