<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-09-23 14:49 GMT+02:00 Abraham Macias <span tabindex="-1" id=":1c7.1" style="" class="">Paredes</span> <span dir="ltr"><<a href="mailto:amacias@solutia-it.es" target="_blank"><span tabindex="-1" id=":1c7.2" style="" class="">amacias</span>@<span tabindex="-1" id=":1c7.3" style="" class="">solutia</span>-it.es</a>></span>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div lang="ES"><div><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Hi again, <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"> After some tests I think that a second “Connect” invalidates the transactions (Python test attached).<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Or maybe there are a couple of seconds of timeout before invalidating the transactions and allowing the connection (because when you run the test you can notice a couple of seconds of delay before the second “connect”).<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">The output of the test in my Windows 10 is:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">c:\Python27>python.exe test.py<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Context established!<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">PCSC Readers: ['Dell Smart Card Reader Keyboard 0']<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Using reader: Dell Smart Card Reader Keyboard 0<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Connected with active protocol 1<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Start transaction<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Connect again<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Connected with active protocol 1<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Start transaction (card 2)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">End transaction (card 2)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">End transaction in the first connection<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Exception: failed to end a transaction: Se ha reiniciado la tarjeta inteligente, por lo que no es vßlida ninguna informaci¾n de estado compartido.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">Released context.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"courier new"">press Enter to continue<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif">Best regards!</span></p></div></div></blockquote><div><br></div><div>On <span tabindex="-1" id=":1c7.4" style="" class="">pcsc</span>-lite your sample output is:<br><br></div><div>$ python test.<span tabindex="-1" id=":1c7.5" style="" class="">py</span> <br>Context established!<br><span tabindex="-1" id=":1c7.6" style="" class="">PCSC</span> Readers: ['Gemalto PC Twin Reader (70D7E2EE) 00 00']<br>Using reader: <span tabindex="-1" id=":1c7.7" style="" class="">Gemalto</span> PC Twin Reader (70D7E2EE) 00 00<br>Connected with active protocol 1<br>Start transaction<br>Connect again<br></div><div>and the execution is blocked here.<br></div><div><br></div><div>The second <span tabindex="-1" id=":1c7.8" style="" class="">SCardConnect</span>() blocks because a transaction is ongoing.<br><br><br></div><div>I guess it "works" on Windows because the card is reset and the transaction is aborted after 5 seconds.<br></div><div>The second <span tabindex="-1" id=":1c7.9" style="" class="">SCardConnect</span>() will block, link with <span tabindex="-1" id=":1c7.10" style="" class="">pcsc</span>-lite, but will continue after a 5 seconds delay.<br></div><div><br>https://<span tabindex="-1" id=":1c7.11" style="" class="">msdn</span>.<span tabindex="-1" id=":1c7.12" style="" class="">microsoft</span>.com/<span tabindex="-1" id=":1c7.13" style="" class="">de</span>-<span tabindex="-1" id=":1c7.14" style="" class="">de</span>/library/windows/desktop/aa379469%28v=vs.85%29.<span tabindex="-1" id=":1c7.15" style="" class="">aspx</span><br>" If a transaction is held on the card for more than five seconds with no 
operations happening on that card, then the card is reset. Calling any 
of the <a href="https://msdn.microsoft.com/de-de/library/windows/desktop/aa380141%28v=vs.85%29.aspx">Smart Card and Reader Access Functions</a> or <a href="https://msdn.microsoft.com/de-de/library/windows/desktop/aa375369%28v=vs.85%29.aspx">Direct Card Access Functions</a> on the card that is transacted results in the timer being reset to continue allowing the transaction to be used. "<br></div><div><br></div><div><span tabindex="-1" id=":1c7.16" style="" class="">pcsc</span>-lite does not implement this card reset after 5 seconds of no-use. I don't think that is a good idea.<br><br></div><div>Bye<br></div><div><br></div></div>-- <br><div> Dr. <span tabindex="-1" id=":1c7.17" style="" class="">Ludovic</span> Rousseau</div>
</div></div>