[PC/SC / MacOSX] Try to connect to the card twice.
[PC/SC / MacOSX] Try to connect to the card twice.

On OS X, when you insert a card, securityd sequentially starts all found Tokend-s to see if a card can be handled with one.
If a non-tokend application waits for a card insertion with sc_wait_for_event and tries to connect to the card right after the system sees it, it will fail with "The reader is in use by another application" 95% of the time.
With this hack connecting to the card succeeds 95% of the time with the probable penalty of an extra second on initialization for non-tokend clients.

This should only affect applications that wait for card insertion events.



git-svn-id: 444ed946b9c2220da791e84c3dd156a05f92db99@3991 c6295689-39f2-0310-b995-f0e70906c6a9

tidatida/OpenSC,OpenSC/OpenSC,fabled/OpenSC,adminmt/OpenSC,financeX/OpenSC,velter/OpenSC,carlhoerberg/OpenSC,carlhoerberg/OpenSC,philipWendland/OpenSC,philipWendland/OpenSC,Jakuje/OpenSC,mouse07410/OpenSC,adminmt/OpenSC,AktivCo/OpenSC,gemini/OpenSC,dirkx/OpenSC,financeX/OpenSC,financeX/OpenSC,OpenSC/OpenSC,CardContact/OpenSC,UIKit0/OpenSC,metsma/OpenSC,l1k/OpenSC,aobaid/OpenSC,CardContact/OpenSC,gentoo/OpenSC,viktorTarasov/OpenSC-SM,UIKit0/OpenSC,dirkx/OpenSC.tokend,dirkx/OpenSC.tokend,metsma/OpenSC,gentoo/OpenSC,carlhoerberg/OpenSC,LudovicRousseau/OpenSC,financeX/OpenSC,fabled/OpenSC,gentoo/OpenSC,0x7678/OpenSC,ieugen/OpenSC,financeX/OpenSC,hhonkanen/OpenSC,dirkx/OpenSC,gentoo/OpenSC,Jakuje/OpenSC,philipWendland/OpenSC,viktorTarasov/OpenSC-SM,gemini/OpenSC,kasparsd/opensc-latvia-id,frankmorgner/OpenSC,tidatida/OpenSC,l1k/OpenSC,Jakuje/OpenSC,rickyepoderi/OpenSC,jpki/OpenSC,mtrojnar/OpenSC,velter/OpenSC,0x7678/myOpenSC,dirkx/OpenSC,CardContact/OpenSC,mouse07410/OpenSC,dirkx/OpenSC.tokend,dirkx/OpenSC,UIKit0/OpenSC,velter/OpenSC,0x7678/OpenSC,AktivCo/OpenSC,ieugen/OpenSC,frankmorgner/OpenSC,marschap/pkg-opensc,nmav/OpenSC,marschap/pkg-opensc,hhonkanen/OpenSC,ieugen/OpenSC,jpki/OpenSC,marschap/pkg-opensc,dengert/OpenSC,rickyepoderi/OpenSC,0x7678/myOpenSC,OpenSC/OpenSC,mtrojnar/OpenSC,aobaid/OpenSC,dirkx/OpenSC,0x7678/OpenSC,kasparsd/opensc-latvia-id,ieugen/OpenSC,0x7678/myOpenSC,carlhoerberg/OpenSC,germanblanco/OpenSC,frankmorgner/OpenSC,jpki/OpenSC,aobaid/OpenSC,hongquan/OpenSC-main,germanblanco/OpenSC,martinpaljak/OpenSC,kasparsd/opensc-latvia-id,adminmt/OpenSC,gemini/OpenSC,martinpaljak/OpenSC,dengert/OpenSC,viktorTarasov/OpenSC-SM,UIKit0/OpenSC,carlhoerberg/OpenSC,ieugen/OpenSC,kasparsd/opensc-latvia-id,aobaid/OpenSC,hhonkanen/OpenSC,hongquan/OpenSC-main,velter/OpenSC,hongquan/OpenSC-main,AktivCo/OpenSC,LudovicRousseau/OpenSC,nmav/OpenSC,fabled/OpenSC,nmav/OpenSC,0x7678/myOpenSC,mouse07410/OpenSC,fabled/OpenSC,0x7678/myOpenSC,germanblanco/OpenSC,rickyepoderi/OpenSC,martinpaljak/OpenSC,adminmt/OpenSC,l1k/OpenSC,dengert/OpenSC,dirkx/OpenSC.tokend,LudovicRousseau/OpenSC,metsma/OpenSC,marschap/pkg-opensc,Jakuje/OpenSC,0x7678/OpenSC,gentoo/OpenSC,dirkx/OpenSC.tokend,mtrojnar/OpenSC,tidatida/OpenSC,dirkx/OpenSC.tokend,frankmorgner/OpenSC,tidatida/OpenSC