[Pcsclite-cvs-commit] r4704 - /trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 2 14:41:59 UTC 2010


Author: rousseau
Date: Tue Feb  2 14:41:58 2010
New Revision: 4704

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4704
Log:
allow to use any reader and not just the first one

Modified:
    trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py

Modified: trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py?rev=4704&op=diff
==============================================================================
--- trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py (original)
+++ trunk/PCSC/UnitaryTests/SCardBlockingBehaviourTest.py Tue Feb  2 14:41:58 2010
@@ -161,7 +161,7 @@
 tests = tests_Win7
 
 
-def Connect():
+def Connect(index=0):
     """docstring for Connect"""
     hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
     if hresult != SCARD_S_SUCCESS:
@@ -173,15 +173,16 @@
     print 'PC/SC Readers:', readers
     if (len(readers) <= 0):
         raise Exception('Reader list is empty, check that a reader is connected')
-    print "Using reader:", readers[0]
+    reader = readers[index]
+    print "Using reader:", reader
 
     # Connect in SCARD_SHARE_SHARED mode
-    hresult, hcard, dwActiveProtocol = SCardConnect(hcontext, readers[0],
+    hresult, hcard, dwActiveProtocol = SCardConnect(hcontext, reader,
         SCARD_SHARE_SHARED, SCARD_PROTOCOL_ANY)
     if hresult != SCARD_S_SUCCESS:
         print "SCardConnect failed"
         raise Exception('Failed to SCardConnect: ' + SCardGetErrorMessage(hresult))
-    return hcontext, hcard, readers[0]
+    return hcontext, hcard, reader
 
 
 def ConnectWithReader(readerName):
@@ -214,7 +215,10 @@
     # Options:
     #   -m : run manually (independent processes)
 
-    hcontext, hcard, readerName = Connect()
+    index = 0
+    if len(sys.argv) > 1:
+        index = int(sys.argv[1])
+    hcontext, hcard, readerName = Connect(index)
     # Creating the test handles here:
     # the test thread can't created them as
     # doing it may block on another call




More information about the Pcsclite-cvs-commit mailing list