2009/10/8 Ludovic Rousseau <[email protected]>:
> 2009/10/1 Paul Klissner <[email protected]>:
>> During some testing of the Sun version of PCSClite we noticed
>> some SCARD_E_SHARING_VIOLATION errors in SCardReconnect().
>>
>> A co-worker pointed out that winscard_clnt.c was patched (2475) in the
>> open source code to make SCardReconnect() loop (re-try) when
>> SCARD_E_SHARING_VIOLATION occurs, thus masking the error.
>>
>> That looks like a workaround for something. But does it mask the
>> error a bit *too* earnestly?
>
> Fixed in revision 4442.
> http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2009-October/003960.html
>
> SCardReconnect(): return SCARD_E_SHARING_VIOLATION instead of blocking
> if the reader cannot be shared.
Jean-Luc Giraud worked on a test suite to check the behavior of PC/SC
function regarding blocking. The program is available at [1].
pcsc-lite differs from Windows when a PC/SC transaction is ongoing:
# Format:
# 'functioname' : [TestFunction, ShouldBlock?]
tests_Win7 = {
'SCardReconnect' : [SCardReconnectTest, True],
'SCardGetAttrib' : [SCardGetAttribTest, False],
'SCardTransmit' : [SCardTransmitTest, True],
'SCardStatus' : [SCardStatusTest, True],
'SCardConnect' : [SCardConnectTest, True],
'SCardBeginTransaction' : [SCardBeginTransactionTest, True]}
tests_Linux = {
'SCardReconnect' : [SCardReconnectTest, False],
'SCardGetAttrib' : [SCardGetAttribTest, False],
'SCardTransmit' : [SCardTransmitTest, False],
'SCardStatus' : [SCardStatusTest, False],
'SCardConnect' : [SCardConnectTest, True],
'SCardBeginTransaction' : [SCardBeginTransactionTest, True]}
The Windows functions are blocking (except for SCardGetAttrib). But
most of the pcsc-lite functions will return SCARD_E_SHARING_VIOLATION
instead.
We now have the source of the change regarding SCardReconnect()
(original problem of this thread). pcsc-lite was patched in revision
2475 [2] to make SCardReconnect() block and then un-patched in
revision 4442 [3] to make it unblock again.
I have not run the tests myself on Windows. I guess Windows XP, Vista
and Seven behave the same but that should be checked first.
Do you think it is a good change to make pcsc-lite calls block instead
of returning SCARD_E_SHARING_VIOLATION? I don't think Windows provides
a timeout or something similar so the call may be blocked for a long
time.
Any comment?
Bye
[1]
http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py
[2]
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2007-March/002640.html
[3]
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2009-October/003960.html
--
Dr. Ludovic Rousseau
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle