<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1433159638620_2735" dir="ltr">Hi everybody,
<br style="" class="">
<br style="" class="">Playing with opensc and the dnie driver I found a weird behavior. After 
some tests I opened the following issue in opensc github:
<br style="" class="">
<br style="" class=""><a id="yui_3_16_0_1_1433159638620_2755" style="" class="" href="https://github.com/OpenSC/OpenSC/issues/475">https://github.com/OpenSC/OpenSC/issues/475</a>
<br style="" class="">
<br style="" class="">It seems that opensc in the method sc_reset finally sends a 
SCardReconnect with SCARD_UNPOWER_CARD or SCARD_RESET_CARD (depending 
the do_cold_reset parameter). But at the end of the sc_reset function 
opensc performs the following:
<br style="" class="">
<br style="" class="">        /* pcsc_reconnect unlocks card... try to lock it again if it 
was locked */
<br style="" class="">        if(old_locked)
<br style="" class="">                r = pcsc_lock(reader);
<br style="" class="">
<br style="" class="">If the connection was previously locked, after the reconnect, it adds a 
lock again (SCardBeginTransaction is called again inside pcsc_lock). My 
impression is that this extra call adds one more lock in the pcsc 
(rContext->LockCount) which is never released, and this ends in the 
complete lock of the card until the current process finishes (no other 
process can access the card in shared mode). Every call to pcsc_reset in 
opensc seems to add a lost lock in pcsc (and the dnie driver calls to 
this reset).
<br style="" class="">
<br style="" class="">I have done some little test with pcsc (with the little sample.c copied 
below) and it seems that SCardReconnect does not lose the locks (in any 
case: SCARD_SHARE_SHARED or SCARD_SHARE_EXCLUSIVE, SCARD_UNPOWER_CARD or 
SCARD_RESET_CARD). But, just to be sure, can anybody confirm that 
SCardReconnect maintains the locks (transactions)? Is the extra call 
done in opensc to SCardBeginTransaction needed?
<br style="" class="">
<br style="" class="">Thanks in advance!</div><div id="yui_3_16_0_1_1433159638620_2806" style="" class=""><br style="" class=""></div></div></body></html>