|
From: <lu...@us...> - 2008-10-06 10:10:56
|
Revision: 230
http://pyscard.svn.sourceforge.net/pyscard/?rev=230&view=rev
Author: ludov
Date: 2008-10-06 10:06:28 +0000 (Mon, 06 Oct 2008)
Log Message:
-----------
remove extra empty lines at end of file
Modified Paths:
--------------
trunk/pyscard/src/smartcard/ATR.py
trunk/pyscard/src/smartcard/AbstractCardRequest.py
trunk/pyscard/src/smartcard/Card.py
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/CardConnectionEvent.py
trunk/pyscard/src/smartcard/CardConnectionObserver.py
trunk/pyscard/src/smartcard/CardMonitoring.py
trunk/pyscard/src/smartcard/CardService.py
trunk/pyscard/src/smartcard/CardType.py
trunk/pyscard/src/smartcard/ClassLoader.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py
trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py
trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py
trunk/pyscard/src/smartcard/Exceptions.py
trunk/pyscard/src/smartcard/PassThruCardService.py
trunk/pyscard/src/smartcard/ReaderMonitoring.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
trunk/pyscard/src/smartcard/pcsc/PCSCContext.py
trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py
trunk/pyscard/src/smartcard/reader/ReaderFactory.py
trunk/pyscard/src/smartcard/reader/ReaderGroups.py
trunk/pyscard/src/smartcard/scard/PcscDefs.i
trunk/pyscard/src/smartcard/scard/helpers.c
trunk/pyscard/src/smartcard/scard/helpers.h
trunk/pyscard/src/smartcard/scard/scard.i
trunk/pyscard/src/smartcard/sw/ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
trunk/pyscard/src/smartcard/sw/ISO7816_4ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ISO7816_4_SW1ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ISO7816_8ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ISO7816_9ErrorChecker.py
trunk/pyscard/src/smartcard/sw/SWExceptions.py
trunk/pyscard/src/smartcard/sw/op21_ErrorChecker.py
trunk/pyscard/src/smartcard/ulist.py
trunk/pyscard/src/smartcard/util/__init__.py
trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py
trunk/pyscard/src/smartcard/wx/ReaderToolbar.py
trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py
trunk/pyscard/src/smartcard/wx/__init__.py
Modified: trunk/pyscard/src/smartcard/ATR.py
===================================================================
--- trunk/pyscard/src/smartcard/ATR.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/ATR.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -287,17 +287,3 @@
a.dump()
print reduce( lambda a, b: a+"%-0.2X " % ((b+256)%256), a.getHistoricalBytes(), '' )
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/AbstractCardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/AbstractCardRequest.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/AbstractCardRequest.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -78,4 +78,3 @@
"""Wait for card insertion or removal."""
pass
-
Modified: trunk/pyscard/src/smartcard/Card.py
===================================================================
--- trunk/pyscard/src/smartcard/Card.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Card.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -69,8 +69,3 @@
#raise CardConnectionException( 'not a valid reader: ' + str(self.reader) )
return None
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -139,14 +139,3 @@
Subclasses must override this method for implementing apdu transmission."""
pass
-
-
-
-
-
-
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/CardConnectionEvent.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionEvent.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/CardConnectionEvent.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -37,11 +37,3 @@
self.type=type
self.args=args
-
-
-
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/CardConnectionObserver.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionObserver.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/CardConnectionObserver.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -62,4 +62,3 @@
else:
print '< ', toHexString(ccevent.args[0]), "%-2X %-2X" % tuple(ccevent.args[-2:])
-
Modified: trunk/pyscard/src/smartcard/CardMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/CardMonitoring.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/CardMonitoring.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -243,4 +243,3 @@
t1.start()
t2.start()
-
Modified: trunk/pyscard/src/smartcard/CardService.py
===================================================================
--- trunk/pyscard/src/smartcard/CardService.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/CardService.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -68,12 +68,3 @@
print "%X %X" % ( sw1, sw2 )
cs.connection.disconnect()
-
-
-
-
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/CardType.py
===================================================================
--- trunk/pyscard/src/smartcard/CardType.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/CardType.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -105,5 +105,3 @@
atrct=ATRCardType( [0x3B, 0x16, 0x94, 0x20, 0x02, 0x01, 0x00, 0x00, 0x0D] )
print atrct.matches( connection.getATR() )
-
-
Modified: trunk/pyscard/src/smartcard/ClassLoader.py
===================================================================
--- trunk/pyscard/src/smartcard/ClassLoader.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/ClassLoader.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -48,5 +48,3 @@
# Return a reference to the class itself, not an instantiated object.
return aClass
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -107,5 +107,3 @@
print 'press Enter to continue'
sys.stdin.read(1)
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -60,5 +60,3 @@
print 'press Enter to continue'
sys.stdin.read(1)
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -51,5 +51,3 @@
print 'press Enter to continue'
sys.stdin.read(1)
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -87,4 +87,3 @@
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -72,5 +72,3 @@
print 'press Enter to continue'
sys.stdin.read(1)
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -64,5 +64,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -83,5 +83,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -61,5 +61,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -68,5 +68,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
-
Modified: trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -76,4 +76,3 @@
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Exceptions.py
===================================================================
--- trunk/pyscard/src/smartcard/Exceptions.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/Exceptions.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -81,5 +81,3 @@
def __init__( self, message="" ):
SmartcardException.__init__( self, 'no readers found' )
-
-
Modified: trunk/pyscard/src/smartcard/PassThruCardService.py
===================================================================
--- trunk/pyscard/src/smartcard/PassThruCardService.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/PassThruCardService.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -59,12 +59,3 @@
print "%X %X" % (sw1, sw2)
cs.connection.disconnect()
-
-
-
-
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/ReaderMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/ReaderMonitoring.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/ReaderMonitoring.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -219,4 +219,3 @@
t1.join()
t2.join()
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -162,12 +162,3 @@
cc.connect()
print "%r %x %x" % cc.transmit( SELECT + DF_TELECOM )
-
-
-
-
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCContext.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -57,4 +57,3 @@
if self.instance:
return getattr( self.instance, name )
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -116,4 +116,3 @@
data, sw1, sw2 = cc.transmit( SELECT + DF_TELECOM )
print "%X %X" % (sw1, sw2)
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -112,4 +112,3 @@
if __name__ == '__main__':
print PCSCReaderGroups()
-
Modified: trunk/pyscard/src/smartcard/reader/ReaderFactory.py
===================================================================
--- trunk/pyscard/src/smartcard/reader/ReaderFactory.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/reader/ReaderFactory.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -54,5 +54,3 @@
return ReaderFactory.factories[clazz].create( readername )
createReader = staticmethod(createReader)
-
-
Modified: trunk/pyscard/src/smartcard/reader/ReaderGroups.py
===================================================================
--- trunk/pyscard/src/smartcard/reader/ReaderGroups.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/reader/ReaderGroups.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -104,4 +104,3 @@
if __name__ == '__main__':
print readergroups()
-
Modified: trunk/pyscard/src/smartcard/scard/PcscDefs.i
===================================================================
--- trunk/pyscard/src/smartcard/scard/PcscDefs.i 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/scard/PcscDefs.i 2008-10-06 10:06:28 UTC (rev 230)
@@ -329,8 +329,3 @@
%constant unsigned long INFINITE = 0xFFFFFFFF ;
#endif // __TIGER__
-
-
-
-
-
Modified: trunk/pyscard/src/smartcard/scard/helpers.c
===================================================================
--- trunk/pyscard/src/smartcard/scard/helpers.c 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/scard/helpers.c 2008-10-06 10:06:28 UTC (rev 230)
@@ -1226,6 +1226,3 @@
}
#endif // WIN32
-
-
-
Modified: trunk/pyscard/src/smartcard/scard/helpers.h
===================================================================
--- trunk/pyscard/src/smartcard/scard/helpers.h 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/scard/helpers.h 2008-10-06 10:06:28 UTC (rev 230)
@@ -112,4 +112,3 @@
STRINGLIST* SCardHelper_PyStringListToStringList(PyObject* source);
void SCardHelper_PrintStringList( STRINGLIST* apsz );
-
Modified: trunk/pyscard/src/smartcard/scard/scard.i
===================================================================
--- trunk/pyscard/src/smartcard/scard/scard.i 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/scard/scard.i 2008-10-06 10:06:28 UTC (rev 230)
@@ -2259,5 +2259,3 @@
%constant char* resourceManagerSubType = "winscard-win32" ;
#endif // WIN32
-
-
Modified: trunk/pyscard/src/smartcard/sw/ErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ErrorChecker.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/ErrorChecker.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -42,5 +42,3 @@
Derived classes must raise a smartcard.sw.SWException upon error."""
pass
-
-
Modified: trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -82,5 +82,3 @@
return
return self.next()( data, sw1, sw2 )
-
-
Modified: trunk/pyscard/src/smartcard/sw/ISO7816_4ErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ISO7816_4ErrorChecker.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/ISO7816_4ErrorChecker.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -158,4 +158,3 @@
except smartcard.sw.SWExceptions.CheckingErrorException, e:
print e, "%x %x" % (e.sw1, e.sw2)
-
Modified: trunk/pyscard/src/smartcard/sw/ISO7816_4_SW1ErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ISO7816_4_SW1ErrorChecker.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/ISO7816_4_SW1ErrorChecker.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -83,4 +83,3 @@
except smartcard.sw.SWExceptions.SecurityRelatedException, e:
print e, "%x %x" % (e.sw1, e.sw2)
-
Modified: trunk/pyscard/src/smartcard/sw/ISO7816_8ErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ISO7816_8ErrorChecker.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/ISO7816_8ErrorChecker.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -132,4 +132,3 @@
except smartcard.sw.SWExceptions.SecurityRelatedException, e:
print e, "%x %x" % (e.sw1, e.sw2)
-
Modified: trunk/pyscard/src/smartcard/sw/ISO7816_9ErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ISO7816_9ErrorChecker.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/ISO7816_9ErrorChecker.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -97,4 +97,3 @@
except smartcard.sw.SWExceptions.CheckingErrorException, e:
print e, "%x %x" % (e.sw1, e.sw2)
-
Modified: trunk/pyscard/src/smartcard/sw/SWExceptions.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/SWExceptions.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/SWExceptions.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -66,4 +66,3 @@
def __init__( self, data, sw1, sw2, message="" ):
SWException.__init__( self, data, sw1, sw2, "checking error - " + message )
-
Modified: trunk/pyscard/src/smartcard/sw/op21_ErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/op21_ErrorChecker.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/sw/op21_ErrorChecker.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -125,4 +125,3 @@
except smartcard.sw.SWExceptions.CheckingErrorException, e:
print e, "%x %x" % (e.sw1, e.sw2)
-
Modified: trunk/pyscard/src/smartcard/ulist.py
===================================================================
--- trunk/pyscard/src/smartcard/ulist.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/ulist.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -117,5 +117,3 @@
"""Called for each item removed. Override in subclasses for adding custom action."""
pass
-
-
Modified: trunk/pyscard/src/smartcard/util/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/util/__init__.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/util/__init__.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -209,5 +209,3 @@
pformat = "0x"+pformat
return rstrip(rstrip(reduce( lambda a, b: a+pformat % ((b+256)%256), [""] + bytes )),',')
-
-
Modified: trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -72,4 +72,3 @@
self.apdutextctrl.AppendText( apduline + "\n" )
-
Modified: trunk/pyscard/src/smartcard/wx/ReaderToolbar.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/ReaderToolbar.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/wx/ReaderToolbar.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -87,6 +87,3 @@
self.Realize()
-
-
-
Modified: trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -306,5 +306,3 @@
if isinstance( reader, smartcard.reader.Reader.Reader ):
self.treeuserpanel.dialogpanel.OnActivateReader( reader )
-
-
Modified: trunk/pyscard/src/smartcard/wx/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/__init__.py 2008-10-06 09:34:26 UTC (rev 229)
+++ trunk/pyscard/src/smartcard/wx/__init__.py 2008-10-06 10:06:28 UTC (rev 230)
@@ -46,4 +46,3 @@
if os.path.exists( os.path.join( "images", 'reader.ico' ) ):
ICO_READER = os.path.join( "images", 'reader.ico' )
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2008-10-06 15:26:43
|
Revision: 232
http://pyscard.svn.sourceforge.net/pyscard/?rev=232&view=rev
Author: ludov
Date: 2008-10-06 13:38:23 +0000 (Mon, 06 Oct 2008)
Log Message:
-----------
do not force CardConnection.T0_protocol by default but use None to reuse
the protocol negociated during connect()
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnectionDecorator.py
trunk/pyscard/src/smartcard/ExclusiveTransmitCardConnection.py
Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2008-10-06 13:37:24 UTC (rev 231)
+++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2008-10-06 13:38:23 UTC (rev 232)
@@ -76,7 +76,7 @@
"""call inner component setProtocol"""
return self.component.setProtocol( protocol )
- def transmit( self, bytes, protocol=CardConnection.T0_protocol ):
+ def transmit( self, bytes, protocol=None ):
"""call inner component transmit"""
return self.component.transmit( bytes, protocol )
Modified: trunk/pyscard/src/smartcard/ExclusiveTransmitCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/ExclusiveTransmitCardConnection.py 2008-10-06 13:37:24 UTC (rev 231)
+++ trunk/pyscard/src/smartcard/ExclusiveTransmitCardConnection.py 2008-10-06 13:38:23 UTC (rev 232)
@@ -71,7 +71,7 @@
break
- def transmit( self, bytes, protocol=CardConnection.T0_protocol ):
+ def transmit( self, bytes, protocol=None ):
'''Gain exclusive access to card during APDU transmission for if this
decorator decorates a PCSCCardConnection.'''
data, sw1, sw2 = CardConnectionDecorator.transmit( self, bytes, protocol )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2008-10-06 15:55:56
|
Revision: 233
http://pyscard.svn.sourceforge.net/pyscard/?rev=233&view=rev
Author: ludov
Date: 2008-10-06 13:49:48 +0000 (Mon, 06 Oct 2008)
Log Message:
-----------
use protocol=None insteaad of CardConnection.T0_protocol as default
value
Modified Paths:
--------------
trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py 2008-10-06 13:38:23 UTC (rev 232)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py 2008-10-06 13:49:48 UTC (rev 233)
@@ -51,7 +51,7 @@
print 'uncyphering', toHexString( data )
return data
- def transmit( self, bytes, protocol=CardConnection.T0_protocol ):
+ def transmit( self, bytes, protocol=None ):
"""Cypher/uncypher APDUs before transmission"""
cypheredbytes = self.cypher( bytes )
data, sw1, sw2 = CardConnectionDecorator.transmit( self, cypheredbytes, protocol )
Modified: trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2008-10-06 13:38:23 UTC (rev 232)
+++ trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2008-10-06 13:49:48 UTC (rev 233)
@@ -1400,7 +1400,7 @@
print 'uncyphering', toHexString( data )
return data
- def transmit( self, bytes, protocol=CardConnection.T0_protocol ):
+ def transmit( self, bytes, protocol=None ):
"""Cypher/uncypher APDUs before transmission"""
cypheredbytes = self.cypher( bytes )
data, sw1, sw2 = CardConnectionDecorator.transmit( self, cypheredbytes, protocol )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-01-13 10:27:28
|
Revision: 256
http://pyscard.svn.sourceforge.net/pyscard/?rev=256&view=rev
Author: ludov
Date: 2009-01-13 10:27:21 +0000 (Tue, 13 Jan 2009)
Log Message:
-----------
set svn:executable on example and test scripts
Property Changed:
----------------
trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CustomErrorChecker.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py
trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py
trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py
trunk/pyscard/src/smartcard/Examples/framework/sample_toHexString.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py
trunk/pyscard/src/smartcard/Examples/simple/getATR.py
trunk/pyscard/src/smartcard/Examples/simple/getATR_T1.py
trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py
trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
trunk/pyscard/src/smartcard/test/configcheck.py
trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py
trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py
trunk/pyscard/src/smartcard/test/framework/testcase_Card.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardRequest.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardType.py
trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py
trunk/pyscard/src/smartcard/test/framework/testcase_ExclusiveCardConnection.py
trunk/pyscard/src/smartcard/test/framework/testcase_readergroups.py
trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py
trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py
trunk/pyscard/src/smartcard/test/framework/testcase_readers.py
trunk/pyscard/src/smartcard/test/framework/testcase_ulist.py
trunk/pyscard/src/smartcard/test/framework/testcase_utils.py
trunk/pyscard/src/smartcard/test/framework/testsuite_framework.py
trunk/pyscard/src/smartcard/test/frameworkpcsc/testcase_pcscreadergroups.py
trunk/pyscard/src/smartcard/test/frameworkpcsc/testsuite_frameworkpcsc.py
trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py
trunk/pyscard/src/smartcard/test/scard/testcase_getatr.py
trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py
trunk/pyscard/src/smartcard/test/scard/testcase_geterrormessage.py
trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py
trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py
trunk/pyscard/src/smartcard/test/scard/testcase_readergroups.py
trunk/pyscard/src/smartcard/test/scard/testcase_transaction.py
trunk/pyscard/src/smartcard/test/scard/testsuite_scard.py
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_CustomErrorChecker.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/framework/sample_toHexString.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/simple/getATR.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/simple/getATR_T1.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/configcheck.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_Card.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_CardRequest.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_CardType.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_ExclusiveCardConnection.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_readergroups.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_readers.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_ulist.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testcase_utils.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/framework/testsuite_framework.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/frameworkpcsc/testcase_pcscreadergroups.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/frameworkpcsc/testsuite_frameworkpcsc.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_getatr.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_geterrormessage.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_readergroups.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testcase_transaction.py
___________________________________________________________________
Added: svn:executable
+ *
Property changes on: trunk/pyscard/src/smartcard/test/scard/testsuite_scard.py
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-06-14 12:04:36
|
Revision: 291
http://pyscard.svn.sourceforge.net/pyscard/?rev=291&view=rev
Author: ludov
Date: 2009-06-14 12:04:25 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
add CardConnection.control() method (high level SCardControl)
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/CardConnectionDecorator.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2009-06-14 11:38:34 UTC (rev 290)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2009-06-14 12:04:25 UTC (rev 291)
@@ -139,3 +139,27 @@
Subclasses must override this method for implementing apdu transmission."""
pass
+ def control( self, controlCode, bytes = [] ):
+ """Send a control command and buffer. Internally calls doControl()
+ class method and notify observers upon command/response events.
+ Subclasses must override the doControl() class method.
+
+ controlCode: command code
+
+ bytes: list of bytes to transmit
+ """
+ Observable.setChanged( self )
+ Observable.notifyObservers( self, CardConnectionEvent('command', [controlCode, bytes] ) )
+ data = self.doControl( controlCode, bytes )
+ Observable.setChanged( self )
+ Observable.notifyObservers( self, CardConnectionEvent( 'response', data ) )
+ if None!=self.errorcheckingchain:
+ self.errorcheckingchain[0]( data )
+ return data
+
+ def doControl( self, controlCode, bytes ):
+ """Performs the command control.
+
+ Subclasses must override this method for implementing control."""
+ pass
+
Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-06-14 11:38:34 UTC (rev 290)
+++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-06-14 12:04:25 UTC (rev 291)
@@ -80,3 +80,7 @@
"""call inner component transmit"""
return self.component.transmit( bytes, protocol )
+ def control( self, controlCode, bytes=[] ):
+ """call inner component control"""
+ return self.component.control( controlCode, bytes )
+
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-06-14 11:38:34 UTC (rev 290)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-06-14 12:04:25 UTC (rev 291)
@@ -160,6 +160,23 @@
data = map(lambda x: (x+256)%256, response[:-2])
return data, sw1, sw2
+ def doControl( self, controlCode, bytes=[] ):
+ """Transmit a control command to the reader and return response.
+
+ controlCode: control command
+
+ bytes: command data to transmit (list of bytes)
+
+ return: response are the response bytes (if any)
+ """
+ CardConnection.doControl( self, controlCode, bytes )
+ hresult, response = SCardControl( self.hcard, controlCode, bytes )
+ if hresult!=0:
+ raise CardConnectionException( 'Failed to control ' + SCardGetErrorMessage(hresult) )
+
+ data = map(lambda x: (x+256)%256, response)
+ return data
+
if __name__ == '__main__':
"""Small sample illustrating the use of CardConnection."""
SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
@@ -169,3 +186,4 @@
cc.connect()
print "%r %x %x" % cc.transmit( SELECT + DF_TELECOM )
+ print cc.control( 0, [] )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-06-26 14:54:37
|
Revision: 294
http://pyscard.svn.sourceforge.net/pyscard/?rev=294&view=rev
Author: ludov
Date: 2009-06-26 14:54:32 +0000 (Fri, 26 Jun 2009)
Log Message:
-----------
connect() now accept a mode parameter. Default value is SCARD_SHARE_SHARED
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/CardConnectionDecorator.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2009-06-16 12:49:49 UTC (rev 293)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2009-06-26 14:54:32 UTC (rev 294)
@@ -70,10 +70,12 @@
"""Remove a CardConnection observer."""
Observable.deleteObserver( self, observer )
- def connect( self, protocol=None ):
+ def connect( self, protocol=None, mode=None ):
"""Connect to card.
protocol: a bit mask of the protocols to use, from CardConnection.T0_protocol, CardConnection.T1_protocol,
CardConnection.RAW_protocol, CardConnection.T15_protocol
+
+ mode: passed as-is to the PC/SC layer
"""
Observable.setChanged( self )
Observable.notifyObservers( self, CardConnectionEvent('connect') )
Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-06-16 12:49:49 UTC (rev 293)
+++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-06-26 14:54:32 UTC (rev 294)
@@ -48,9 +48,9 @@
"""call inner component deleteObserver"""
self.component.deleteObserver( observer )
- def connect( self, protocol=None ):
+ def connect( self, protocol=None, mode=None ):
"""call inner component connect"""
- self.component.connect( protocol )
+ self.component.connect( protocol, mode )
def disconnect( self ):
"""call inner component disconnect"""
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-06-16 12:49:49 UTC (rev 293)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-06-26 14:54:32 UTC (rev 294)
@@ -82,14 +82,19 @@
raise CardConnectionException( 'Failed to release context: ' + SCardGetErrorMessage(hresult) )
CardConnection.__del__( self )
- def connect( self, protocol=None ):
- """Connect to the card. If protocol is not specified, connect with the default connection protocol."""
+ def connect( self, protocol=None, mode=None ):
+ """Connect to the card.
+
+ If protocol is not specified, connect with the default connection protocol.
+
+ If mode is not specified, connect with SCARD_SHARE_SHARED."""
CardConnection.connect( self, protocol )
pcscprotocol = translateprotocolmask( protocol )
if 0==pcscprotocol: pcscprotocol = self.getProtocol()
+ if mode==None: mode = SCARD_SHARE_SHARED
hresult, self.hcard, dwActiveProtocol = SCardConnect(
- self.hcontext, str(self.reader), SCARD_SHARE_SHARED, pcscprotocol )
+ self.hcontext, str(self.reader), mode, pcscprotocol )
if hresult!=0:
self.hcard=None
if SCARD_W_REMOVED_CARD==hresult:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-16 10:39:06
|
Revision: 328
http://pyscard.svn.sourceforge.net/pyscard/?rev=328&view=rev
Author: ludov
Date: 2009-11-16 10:38:57 +0000 (Mon, 16 Nov 2009)
Log Message:
-----------
W292 no newline at end of file
Modified Paths:
--------------
trunk/pyscard/src/smartcard/Observer.py
trunk/pyscard/src/smartcard/Synchronization.py
Modified: trunk/pyscard/src/smartcard/Observer.py
===================================================================
--- trunk/pyscard/src/smartcard/Observer.py 2009-11-16 10:34:42 UTC (rev 327)
+++ trunk/pyscard/src/smartcard/Observer.py 2009-11-16 10:38:57 UTC (rev 328)
@@ -65,4 +65,4 @@
"addObserver deleteObserver deleteObservers " +
"setChanged clearChanged hasChanged " +
"countObservers")
-#:~
\ No newline at end of file
+#:~
Modified: trunk/pyscard/src/smartcard/Synchronization.py
===================================================================
--- trunk/pyscard/src/smartcard/Synchronization.py 2009-11-16 10:34:42 UTC (rev 327)
+++ trunk/pyscard/src/smartcard/Synchronization.py 2009-11-16 10:38:57 UTC (rev 328)
@@ -36,4 +36,4 @@
class Synchronization:
def __init__(self):
self.mutex = RLock()
-#:~
\ No newline at end of file
+#:~
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-16 10:52:09
|
Revision: 329
http://pyscard.svn.sourceforge.net/pyscard/?rev=329&view=rev
Author: ludov
Date: 2009-11-16 10:51:53 +0000 (Mon, 16 Nov 2009)
Log Message:
-----------
pep8: W391 blank line at end of file
Modified Paths:
--------------
trunk/pyscard/src/smartcard/ATR.py
trunk/pyscard/src/smartcard/AbstractCardRequest.py
trunk/pyscard/src/smartcard/Card.py
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/CardConnectionDecorator.py
trunk/pyscard/src/smartcard/CardConnectionEvent.py
trunk/pyscard/src/smartcard/CardConnectionObserver.py
trunk/pyscard/src/smartcard/CardMonitoring.py
trunk/pyscard/src/smartcard/CardNames.py
trunk/pyscard/src/smartcard/CardRequest.py
trunk/pyscard/src/smartcard/CardService.py
trunk/pyscard/src/smartcard/CardType.py
trunk/pyscard/src/smartcard/ClassLoader.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py
trunk/pyscard/src/smartcard/Examples/framework/sample_CustomErrorChecker.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py
trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py
trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py
trunk/pyscard/src/smartcard/Examples/framework/sample_toHexString.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_pinpad.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py
trunk/pyscard/src/smartcard/Examples/simple/getATR.py
trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
trunk/pyscard/src/smartcard/Exceptions.py
trunk/pyscard/src/smartcard/PassThruCardService.py
trunk/pyscard/src/smartcard/ReaderMonitoring.py
trunk/pyscard/src/smartcard/Session.py
trunk/pyscard/src/smartcard/System.py
trunk/pyscard/src/smartcard/__init__.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py
trunk/pyscard/src/smartcard/pcsc/PCSCContext.py
trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py
trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py
trunk/pyscard/src/smartcard/reader/Reader.py
trunk/pyscard/src/smartcard/reader/ReaderFactory.py
trunk/pyscard/src/smartcard/reader/ReaderGroups.py
trunk/pyscard/src/smartcard/reader/__init__.py
trunk/pyscard/src/smartcard/sw/ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
trunk/pyscard/src/smartcard/sw/ISO7816_4ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ISO7816_4_SW1ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ISO7816_8ErrorChecker.py
trunk/pyscard/src/smartcard/sw/ISO7816_9ErrorChecker.py
trunk/pyscard/src/smartcard/sw/SWExceptions.py
trunk/pyscard/src/smartcard/sw/__init__.py
trunk/pyscard/src/smartcard/sw/op21_ErrorChecker.py
trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py
trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py
trunk/pyscard/src/smartcard/test/framework/testcase_Card.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardRequest.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py
trunk/pyscard/src/smartcard/test/framework/testcase_CardType.py
trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py
trunk/pyscard/src/smartcard/test/framework/testcase_ExclusiveCardConnection.py
trunk/pyscard/src/smartcard/test/framework/testcase_readergroups.py
trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py
trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py
trunk/pyscard/src/smartcard/test/framework/testcase_readers.py
trunk/pyscard/src/smartcard/test/framework/testsuite_framework.py
trunk/pyscard/src/smartcard/test/frameworkpcsc/testcase_pcscreadergroups.py
trunk/pyscard/src/smartcard/test/frameworkpcsc/testsuite_frameworkpcsc.py
trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py
trunk/pyscard/src/smartcard/test/scard/testcase_getatr.py
trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py
trunk/pyscard/src/smartcard/test/scard/testcase_geterrormessage.py
trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py
trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py
trunk/pyscard/src/smartcard/test/scard/testcase_readergroups.py
trunk/pyscard/src/smartcard/test/scard/testcase_returncodes.py
trunk/pyscard/src/smartcard/test/scard/testcase_transaction.py
trunk/pyscard/src/smartcard/test/scard/testsuite_scard.py
trunk/pyscard/src/smartcard/ulist.py
trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py
trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py
trunk/pyscard/src/smartcard/wx/ReaderToolbar.py
trunk/pyscard/src/smartcard/wx/SimpleSCardAppEventObserver.py
trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py
trunk/pyscard/src/smartcard/wx/__init__.py
Modified: trunk/pyscard/src/smartcard/ATR.py
===================================================================
--- trunk/pyscard/src/smartcard/ATR.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/ATR.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -286,4 +286,3 @@
print a
a.dump()
print reduce( lambda a, b: a+"%-0.2X " % ((b+256)%256), a.getHistoricalBytes(), '' )
-
Modified: trunk/pyscard/src/smartcard/AbstractCardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/AbstractCardRequest.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/AbstractCardRequest.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -77,4 +77,3 @@
def waitforcardevent( self ):
"""Wait for card insertion or removal."""
pass
-
Modified: trunk/pyscard/src/smartcard/Card.py
===================================================================
--- trunk/pyscard/src/smartcard/Card.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Card.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -68,4 +68,3 @@
else:
#raise CardConnectionException( 'not a valid reader: ' + str(self.reader) )
return None
-
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -164,4 +164,3 @@
Subclasses must override this method for implementing control."""
pass
-
Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -83,4 +83,3 @@
def control( self, controlCode, bytes=[] ):
"""call inner component control"""
return self.component.control( controlCode, bytes )
-
Modified: trunk/pyscard/src/smartcard/CardConnectionEvent.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionEvent.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardConnectionEvent.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -36,4 +36,3 @@
def __init__( self, type, args=None):
self.type=type
self.args=args
-
Modified: trunk/pyscard/src/smartcard/CardConnectionObserver.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionObserver.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardConnectionObserver.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -61,4 +61,3 @@
print '< [] ', "%-2X %-2X" % tuple(ccevent.args[-2:])
else:
print '< ', toHexString(ccevent.args[0]), "%-2X %-2X" % tuple(ccevent.args[-2:])
-
Modified: trunk/pyscard/src/smartcard/CardMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/CardMonitoring.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardMonitoring.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -242,4 +242,3 @@
t2 = testthread(2)
t1.start()
t2.start()
-
Modified: trunk/pyscard/src/smartcard/CardNames.py
===================================================================
--- trunk/pyscard/src/smartcard/CardNames.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardNames.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -103,4 +103,3 @@
cn.delete( "Palmera Protect V2" )
print '---------'
cn.dump()
-
Modified: trunk/pyscard/src/smartcard/CardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/CardRequest.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardRequest.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -75,4 +75,3 @@
cs.connection.connect()
print cs.connection.getReader(), toHexString(cs.connection.getATR())
cs.connection.disconnect()
-
Modified: trunk/pyscard/src/smartcard/CardService.py
===================================================================
--- trunk/pyscard/src/smartcard/CardService.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardService.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -67,4 +67,3 @@
data, sw1, sw2 = cs.connection.transmit( SELECT + DF_TELECOM )
print "%X %X" % ( sw1, sw2 )
cs.connection.disconnect()
-
Modified: trunk/pyscard/src/smartcard/CardType.py
===================================================================
--- trunk/pyscard/src/smartcard/CardType.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/CardType.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -104,4 +104,3 @@
connection.connect()
atrct=ATRCardType( [0x3B, 0x16, 0x94, 0x20, 0x02, 0x01, 0x00, 0x00, 0x0D] )
print atrct.matches( connection.getATR() )
-
Modified: trunk/pyscard/src/smartcard/ClassLoader.py
===================================================================
--- trunk/pyscard/src/smartcard/ClassLoader.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/ClassLoader.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -47,4 +47,3 @@
# Return a reference to the class itself, not an instantiated object.
return aClass
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -36,4 +36,3 @@
print 'T0 supported: ', atr.isT0Supported()
print 'T1 supported: ', atr.isT1Supported()
print 'T15 supported: ', atr.isT15Supported()
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_CardConnectionDecorator.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -106,4 +106,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ConsoleConnectionTracer.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -59,4 +59,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_CustomCardType.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -50,4 +50,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_CustomErrorChecker.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_CustomErrorChecker.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_CustomErrorChecker.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -85,4 +85,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ErrorChecking.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -86,4 +86,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ExclusiveCardConnection.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -71,4 +71,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCards.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -63,4 +63,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -82,4 +82,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_MonitorReaders.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -60,4 +60,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_TransmitCardObserver.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -67,4 +67,3 @@
except:
print exc_info()[0], ':', exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_apduTracerInterpreter.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -87,4 +87,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_toHexString.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_toHexString.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_toHexString.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -55,4 +55,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -96,4 +96,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -82,4 +82,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -144,4 +144,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -100,4 +100,3 @@
except error:
import sys
print sys.exc_info()[0], ':', sys.exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -76,4 +76,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -89,4 +89,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -118,4 +118,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_pinpad.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_pinpad.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_pinpad.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -122,4 +122,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -118,4 +118,3 @@
except error:
import sys
print sys.exc_info()[0], ':', sys.exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -57,4 +57,3 @@
except error:
import sys
print sys.exc_info()[0], ':', sys.exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -89,4 +89,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -93,4 +93,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/simple/getATR.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/simple/getATR.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/simple/getATR.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -40,4 +40,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/simple/selectDF_TELECOM.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -75,4 +75,3 @@
if 'win32'==sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
-
Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -41,6 +41,3 @@
if __name__ == "__main__":
import sys
main( sys.argv )
-
-
-
Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -97,6 +97,3 @@
if __name__ == "__main__":
import sys
main( sys.argv )
-
-
-
Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -38,6 +38,3 @@
if __name__ == "__main__":
import sys
main( sys.argv )
-
-
-
Modified: trunk/pyscard/src/smartcard/Exceptions.py
===================================================================
--- trunk/pyscard/src/smartcard/Exceptions.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Exceptions.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -80,4 +80,3 @@
"""Raised when the system has no smartcard reader."""
def __init__( self, message="" ):
SmartcardException.__init__( self, 'no readers found' )
-
Modified: trunk/pyscard/src/smartcard/PassThruCardService.py
===================================================================
--- trunk/pyscard/src/smartcard/PassThruCardService.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/PassThruCardService.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -58,4 +58,3 @@
data, sw1, sw2 = cs.connection.transmit( SELECT + DF_TELECOM )
print "%X %X" % (sw1, sw2)
cs.connection.disconnect()
-
Modified: trunk/pyscard/src/smartcard/ReaderMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/ReaderMonitoring.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/ReaderMonitoring.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -218,4 +218,3 @@
t2.start()
t1.join()
t2.join()
-
Modified: trunk/pyscard/src/smartcard/Session.py
===================================================================
--- trunk/pyscard/src/smartcard/Session.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/Session.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -113,4 +113,3 @@
if __name__ == '__main__':
"""Small sample illustrating the use of Session.py."""
pass
-
Modified: trunk/pyscard/src/smartcard/System.py
===================================================================
--- trunk/pyscard/src/smartcard/System.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/System.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -64,4 +64,3 @@
except:
import sys
print sys.exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/__init__.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/__init__.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -36,4 +36,3 @@
# for legacy only
from smartcard.System import listReaders
from smartcard.Session import Session
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -312,4 +312,3 @@
cs.connection.connect()
print cs.connection.getReader(), toHexString(cs.connection.getATR())
cs.connection.disconnect()
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCContext.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -55,4 +55,3 @@
def __getattr__( self, name ):
if self.instance:
return getattr( self.instance, name )
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2009-11-16 10:51:53 UTC (rev 329)
@@ -70,4 +70,3 @@
raise EstablishContextException( smartcard.scard.SCARD_E_NO_MEMORY )
except:
print sys.exc_info()[1]
-
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2009-11-16 10:38:57 UTC (rev 328)
+++ trunk/pyscard/src/smartcard/pcsc...
[truncated message content] |
|
From: <lu...@us...> - 2009-11-22 15:20:15
|
Revision: 351
http://pyscard.svn.sourceforge.net/pyscard/?rev=351&view=rev
Author: ludov
Date: 2009-11-22 15:20:07 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E303 too many blank lines
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardType.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py
trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py
Modified: trunk/pyscard/src/smartcard/CardType.py
===================================================================
--- trunk/pyscard/src/smartcard/CardType.py 2009-11-22 15:17:57 UTC (rev 350)
+++ trunk/pyscard/src/smartcard/CardType.py 2009-11-22 15:20:07 UTC (rev 351)
@@ -94,7 +94,6 @@
maskedatr=atr
return self.maskedatr==maskedatr
-
if __name__ == '__main__':
"""Small sample illustrating the use of CardType.py."""
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py 2009-11-22 15:17:57 UTC (rev 350)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py 2009-11-22 15:20:07 UTC (rev 351)
@@ -56,8 +56,6 @@
if hresult==0:
print i, 'CSP Provider:', providername
-
-
finally:
hresult = SCardReleaseContext( hcontext )
if hresult!=0:
Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2009-11-22 15:17:57 UTC (rev 350)
+++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2009-11-22 15:20:07 UTC (rev 351)
@@ -96,9 +96,6 @@
if eventstate & SCARD_STATE_UNKNOWN:
print 'State unknowned'
-
-
-
finally:
hresult = SCardForgetCardType( hcontext, znewcardName )
hresult = SCardReleaseContext( hcontext )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 15:24:26
|
Revision: 352
http://pyscard.svn.sourceforge.net/pyscard/?rev=352&view=rev
Author: ludov
Date: 2009-11-22 15:24:17 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E401 multiple imports on one line
Modified Paths:
--------------
trunk/pyscard/src/smartcard/ClassLoader.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py
Modified: trunk/pyscard/src/smartcard/ClassLoader.py
===================================================================
--- trunk/pyscard/src/smartcard/ClassLoader.py 2009-11-22 15:20:07 UTC (rev 351)
+++ trunk/pyscard/src/smartcard/ClassLoader.py 2009-11-22 15:24:17 UTC (rev 352)
@@ -7,7 +7,8 @@
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223972
"""
-import sys, types
+import sys
+import types
def get_mod(modulePath):
"""Import a module."""
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py 2009-11-22 15:20:07 UTC (rev 351)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py 2009-11-22 15:24:17 UTC (rev 352)
@@ -22,7 +22,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
-import threading, time
+import threading
+import time
from smartcard.AbstractCardRequest import AbstractCardRequest
from smartcard.Exceptions import CardRequestTimeoutException, CardRequestException, ListReadersException
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 15:27:12
|
Revision: 353
http://pyscard.svn.sourceforge.net/pyscard/?rev=353&view=rev
Author: ludov
Date: 2009-11-22 15:27:05 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E222 multiple spaces after operator
Modified Paths:
--------------
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
trunk/pyscard/src/smartcard/Session.py
Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2009-11-22 15:24:17 UTC (rev 352)
+++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2009-11-22 15:27:05 UTC (rev 353)
@@ -101,7 +101,7 @@
data, sw1, sw2 = self.selectedcard.connection.transmit( toBytes( apdu ) )
self.SW1textctrl.SetValue( "%x" % sw1 )
self.SW2textctrl.SetValue( "%x" % sw2 )
- self.responsetextctrl.SetValue( toHexString( data + [sw1, sw2] ) )
+ self.responsetextctrl.SetValue( toHexString( data + [sw1, sw2] ) )
event.Skip()
def layoutControls( self ):
Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2009-11-22 15:24:17 UTC (rev 352)
+++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2009-11-22 15:27:05 UTC (rev 353)
@@ -33,7 +33,7 @@
app = SimpleSCardApp(
appname = 'A tool to send apdu to a card',
apppanel = SampleAPDUManagerPanel,
- appstyle = TR_SMARTCARD | TR_READER | PANEL_APDUTRACER,
+ appstyle = TR_SMARTCARD | TR_READER | PANEL_APDUTRACER,
appicon = os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
size = (800,600) )
app.MainLoop()
Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2009-11-22 15:24:17 UTC (rev 352)
+++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2009-11-22 15:27:05 UTC (rev 353)
@@ -89,7 +89,7 @@
app = SimpleSCardApp(
appname = 'A simple card monitoring tool',
apppanel = SamplePanel,
- appstyle = TR_SMARTCARD | TR_READER,
+ appstyle = TR_SMARTCARD | TR_READER,
appicon = os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
size = (800,600) )
app.MainLoop()
Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2009-11-22 15:24:17 UTC (rev 352)
+++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2009-11-22 15:27:05 UTC (rev 353)
@@ -30,7 +30,7 @@
app = SimpleSCardApp(
appname = 'A simple reader monitoring tool',
apppanel = None,
- appstyle = TR_READER,
+ appstyle = TR_READER,
appicon = os.path.join( os.path.dirname( __file__ ), 'images', 'readerviewer.ico' ),
size = (800,600) )
app.MainLoop()
Modified: trunk/pyscard/src/smartcard/Session.py
===================================================================
--- trunk/pyscard/src/smartcard/Session.py 2009-11-22 15:24:17 UTC (rev 352)
+++ trunk/pyscard/src/smartcard/Session.py 2009-11-22 15:27:05 UTC (rev 353)
@@ -94,7 +94,7 @@
sw1, sw2 are the two status words
"""
- response, sw1, sw2 = self.cs.connection.transmit( command )
+ response, sw1, sw2 = self.cs.connection.transmit( command )
if len(response)>2:
response.append( sw1 )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 16:38:58
|
Revision: 354
http://pyscard.svn.sourceforge.net/pyscard/?rev=354&view=rev
Author: ludov
Date: 2009-11-22 16:38:51 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E702 multiple statements on one line (semicolon)
Modified Paths:
--------------
trunk/pyscard/src/smartcard/Synchronization.py
trunk/pyscard/src/smartcard/pcsc/PCSCContext.py
trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py
Modified: trunk/pyscard/src/smartcard/Synchronization.py
===================================================================
--- trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 15:27:05 UTC (rev 353)
+++ trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 16:38:51 UTC (rev 354)
@@ -11,12 +11,12 @@
def synchronized(method):
def f(*args):
self = args[0]
- self.mutex.acquire();
+ self.mutex.acquire()
# print method.__name__, 'acquired'
try:
return apply(method, args)
finally:
- self.mutex.release();
+ self.mutex.release()
# print method.__name__, 'released'
return f
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCContext.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2009-11-22 15:27:05 UTC (rev 353)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2009-11-22 16:38:51 UTC (rev 354)
@@ -45,12 +45,12 @@
instance = None
def __init__( self ):
- PCSCContext.mutex.acquire();
+ PCSCContext.mutex.acquire()
try:
if not PCSCContext.instance:
PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
finally:
- PCSCContext.mutex.release();
+ PCSCContext.mutex.release()
def __getattr__( self, name ):
if self.instance:
Modified: trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py 2009-11-22 15:27:05 UTC (rev 353)
+++ trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py 2009-11-22 16:38:51 UTC (rev 354)
@@ -197,7 +197,7 @@
self.Expand(self.root)
finally:
- self.mutex.release();
+ self.mutex.release()
self.EnsureVisible( self.root )
self.Repaint()
@@ -226,7 +226,7 @@
self.Expand(childReader)
self.Expand(self.root)
finally:
- self.mutex.release();
+ self.mutex.release()
self.EnsureVisible( self.root )
self.Repaint()
@@ -249,7 +249,7 @@
( childReader, cookie ) = self.GetNextChild( parentnode, cookie )
self.Expand(self.root)
finally:
- self.mutex.release();
+ self.mutex.release()
self.EnsureVisible( self.root )
self.Repaint()
@@ -268,7 +268,7 @@
( childReader, cookie ) = self.GetNextChild( parentnode, cookie )
self.Expand(self.root)
finally:
- self.mutex.release();
+ self.mutex.release()
self.EnsureVisible( self.root )
self.Repaint()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 16:44:23
|
Revision: 355
http://pyscard.svn.sourceforge.net/pyscard/?rev=355&view=rev
Author: ludov
Date: 2009-11-22 16:44:13 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E251 no spaces around keyword / parameter equals
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
trunk/pyscard/src/smartcard/Observer.py
trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py
trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py
trunk/pyscard/src/smartcard/wx/ReaderToolbar.py
trunk/pyscard/src/smartcard/wx/SimpleSCardApp.py
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -141,7 +141,7 @@
Subclasses must override this method for implementing apdu transmission."""
pass
- def control( self, controlCode, bytes = [] ):
+ def control( self, controlCode, bytes=[] ):
"""Send a control command and buffer. Internally calls doControl()
class method and notify observers upon command/response events.
Subclasses must override the doControl() class method.
Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -110,7 +110,7 @@
statictextCommand = wx.StaticText( self, ID_TEXT_COMMAND, "Command", wx.DefaultPosition, wx.DefaultSize, 0 )
self.commandtextctrl = wx.TextCtrl( self, ID_TEXTCTRL_COMMAND, "",
wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE,
- validator = APDUHexValidator() )
+ validator=APDUHexValidator() )
statictextResponse = wx.StaticText( self, ID_TEXT_RESPONSE, "Response", wx.DefaultPosition, wx.DefaultSize, 0 )
self.responsetextctrl = wx.TextCtrl( self, ID_TEXTCTRL_RESPONSE, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY )
statictextStatusWords = wx.StaticText( self, ID_TEXT_SW, "Status Words", wx.DefaultPosition, wx.DefaultSize, 0 )
Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -31,11 +31,11 @@
def main( argv ):
app = SimpleSCardApp(
- appname = 'A tool to send apdu to a card',
- apppanel = SampleAPDUManagerPanel,
- appstyle = TR_SMARTCARD | TR_READER | PANEL_APDUTRACER,
- appicon = os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
- size = (800,600) )
+ appname='A tool to send apdu to a card',
+ apppanel=SampleAPDUManagerPanel,
+ appstyle=TR_SMARTCARD | TR_READER | PANEL_APDUTRACER,
+ appicon=os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
+ size=(800,600) )
app.MainLoop()
if __name__ == "__main__":
Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -87,11 +87,11 @@
def main( argv ):
app = SimpleSCardApp(
- appname = 'A simple card monitoring tool',
- apppanel = SamplePanel,
- appstyle = TR_SMARTCARD | TR_READER,
- appicon = os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
- size = (800,600) )
+ appname='A simple card monitoring tool',
+ apppanel=SamplePanel,
+ appstyle=TR_SMARTCARD | TR_READER,
+ appicon=os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
+ size=(800,600) )
app.MainLoop()
if __name__ == "__main__":
Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -28,11 +28,11 @@
def main( argv ):
app = SimpleSCardApp(
- appname = 'A simple reader monitoring tool',
- apppanel = None,
- appstyle = TR_READER,
- appicon = os.path.join( os.path.dirname( __file__ ), 'images', 'readerviewer.ico' ),
- size = (800,600) )
+ appname='A simple reader monitoring tool',
+ apppanel=None,
+ appstyle=TR_READER,
+ appicon=os.path.join( os.path.dirname( __file__ ), 'images', 'readerviewer.ico' ),
+ size=(800,600) )
app.MainLoop()
if __name__ == "__main__":
Modified: trunk/pyscard/src/smartcard/Observer.py
===================================================================
--- trunk/pyscard/src/smartcard/Observer.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/Observer.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -35,7 +35,7 @@
def deleteObserver(self, observer):
self.obs.remove(observer)
- def notifyObservers(self, arg = None):
+ def notifyObservers(self, arg=None):
'''If 'changed' indicates that this object
has changed, notify all its observers, then
call clearChanged(). Each observer has its
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -98,7 +98,7 @@
if f[0] == feature or Features[f[0]] == feature:
return f[1]
-def getPinProperties(cardConnection, featureList = None, controlCode = None):
+def getPinProperties(cardConnection, featureList=None, controlCode=None):
""" return the PIN_PROPERTIES structure
cardConnection: CardConnection object
Modified: trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/wx/CardAndReaderTreePanel.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -42,7 +42,7 @@
ID=wx.NewId(),
pos=wx.DefaultPosition,
size=wx.DefaultSize,
- style= 0,
+ style=0,
clientpanel=None ):
"""Constructor. Initializes a smartcard or reader tree control."""
wx.TreeCtrl.__init__( self, parent, ID, pos, size , wx.TR_SINGLE | wx.TR_NO_BUTTONS )
@@ -75,7 +75,7 @@
ID=wx.NewId(),
pos=wx.DefaultPosition,
size=wx.DefaultSize,
- style= 0,
+ style=0,
clientpanel=None ):
"""Constructor. Create a smartcard tree control."""
BaseCardTreeCtrl.__init__( self, parent, ID, pos, size ,
@@ -125,7 +125,7 @@
ID=wx.NewId(),
pos=wx.DefaultPosition,
size=wx.DefaultSize,
- style= 0,
+ style=0,
clientpanel=None ):
"""Constructor. Create a reader tree control."""
Modified: trunk/pyscard/src/smartcard/wx/ReaderToolbar.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/ReaderToolbar.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/wx/ReaderToolbar.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -32,7 +32,7 @@
"""Constructor. Registers as ReaderObserver to get
notifications of reader insertion/removal."""
wx.ComboBox.__init__( self, parent, wx.NewId(),
- size=(170,-1), style = wx.CB_DROPDOWN | wx.CB_SORT ,
+ size=(170,-1), style=wx.CB_DROPDOWN | wx.CB_SORT ,
choices=[] )
# register as a ReaderObserver; we will ge notified of added/removed readers
@@ -63,7 +63,7 @@
parent,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
- style = wx.SIMPLE_BORDER | wx.TB_HORIZONTAL | wx.TB_FLAT | wx.TB_TEXT,
+ style=wx.SIMPLE_BORDER | wx.TB_HORIZONTAL | wx.TB_FLAT | wx.TB_TEXT,
name='Reader Toolbar' )
# create bitmaps for toolbar
Modified: trunk/pyscard/src/smartcard/wx/SimpleSCardApp.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/SimpleSCardApp.py 2009-11-22 16:38:51 UTC (rev 354)
+++ trunk/pyscard/src/smartcard/wx/SimpleSCardApp.py 2009-11-22 16:44:13 UTC (rev 355)
@@ -38,12 +38,12 @@
SimpleSCardApp is a subclass of wx.App.
"""
def __init__( self,
- appname = '',
- apppanel = None,
- appstyle = TR_DEFAULT,
- appicon = None,
- pos = (-1,-1),
- size = (-1,-1) ):
+ appname='',
+ apppanel=None,
+ appstyle=TR_DEFAULT,
+ appicon=None,
+ pos=(-1,-1),
+ size=(-1,-1) ):
"""Constructor for simple smart card application.
appname: the application name
apppanel: the application panel to display in the application frame
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 16:47:10
|
Revision: 356
http://pyscard.svn.sourceforge.net/pyscard/?rev=356&view=rev
Author: ludov
Date: 2009-11-22 16:47:03 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E221 multiple spaces before operator
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py
trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py
trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2009-11-22 16:44:13 UTC (rev 355)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2009-11-22 16:47:03 UTC (rev 356)
@@ -32,10 +32,10 @@
Known subclasses: smartcard.pcsc.PCSCCardConnection
"""
- T0_protocol = 0x00000001
- T1_protocol = 0x00000002
- RAW_protocol = 0x00010000
- T15_protocol = 0x00000008
+ T0_protocol = 0x00000001
+ T1_protocol = 0x00000002
+ RAW_protocol = 0x00010000
+ T15_protocol = 0x00000008
def __init__( self, reader ):
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py 2009-11-22 16:44:13 UTC (rev 355)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCPart10.py 2009-11-22 16:47:03 UTC (rev 356)
@@ -25,25 +25,25 @@
from smartcard.scard import *
# constants defined in PC/SC v2 Part 10
-CM_IOCTL_GET_FEATURE_REQUEST = SCARD_CTL_CODE(3400)
+CM_IOCTL_GET_FEATURE_REQUEST = SCARD_CTL_CODE(3400)
-FEATURE_VERIFY_PIN_START = 0x01
-FEATURE_VERIFY_PIN_FINISH = 0x02
-FEATURE_MODIFY_PIN_START = 0x03
-FEATURE_MODIFY_PIN_FINISH = 0x04
-FEATURE_GET_KEY_PRESSED = 0x05
-FEATURE_VERIFY_PIN_DIRECT = 0x06
-FEATURE_MODIFY_PIN_DIRECT = 0x07
-FEATURE_MCT_READERDIRECT = 0x08
-FEATURE_MCT_UNIVERSAL = 0x09
-FEATURE_IFD_PIN_PROPERTIES = 0x0A
-FEATURE_ABORT = 0x0B
-FEATURE_SET_SPE_MESSAGE = 0x0C
+FEATURE_VERIFY_PIN_START = 0x01
+FEATURE_VERIFY_PIN_FINISH = 0x02
+FEATURE_MODIFY_PIN_START = 0x03
+FEATURE_MODIFY_PIN_FINISH = 0x04
+FEATURE_GET_KEY_PRESSED = 0x05
+FEATURE_VERIFY_PIN_DIRECT = 0x06
+FEATURE_MODIFY_PIN_DIRECT = 0x07
+FEATURE_MCT_READERDIRECT = 0x08
+FEATURE_MCT_UNIVERSAL = 0x09
+FEATURE_IFD_PIN_PROPERTIES = 0x0A
+FEATURE_ABORT = 0x0B
+FEATURE_SET_SPE_MESSAGE = 0x0C
FEATURE_VERIFY_PIN_DIRECT_APP_ID = 0x0D
FEATURE_MODIFY_PIN_DIRECT_APP_ID = 0x0E
-FEATURE_WRITE_DISPLAY = 0x0F
-FEATURE_GET_KEY = 0x10
-FEATURE_IFD_DISPLAY_PROPERTIES = 0x11
+FEATURE_WRITE_DISPLAY = 0x0F
+FEATURE_GET_KEY = 0x10
+FEATURE_IFD_DISPLAY_PROPERTIES = 0x11
Features = {
"FEATURE_VERIFY_PIN_START" : FEATURE_VERIFY_PIN_START,
Modified: trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py
===================================================================
--- trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2009-11-22 16:44:13 UTC (rev 355)
+++ trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2009-11-22 16:47:03 UTC (rev 356)
@@ -41,7 +41,7 @@
hresult, self.hcontext = SCardEstablishContext( SCARD_SCOPE_USER )
self.assertEquals(hresult, 0)
self.dummycardname = 'dummycard'
- self.dummycardATR = [ 0x3B, 0x75, 0x94, 0x00, 0x00, 0x62, 0x02, 0x02, 0x01, 0x01 ]
+ self.dummycardATR = [ 0x3B, 0x75, 0x94, 0x00, 0x00, 0x62, 0x02, 0x02, 0x01, 0x01 ]
self.dummycardMask = [ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ]
self.dummycardguid1 = smartcard.guid.strToGUID('{AD4F1667-EA75-4124-84D4-641B3B197C65}')
self.dummycardguid2 = smartcard.guid.strToGUID('{382AE95A-7C2C-449c-A179-56C6DE6FF3BC}')
Modified: trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py 2009-11-22 16:44:13 UTC (rev 355)
+++ trunk/pyscard/src/smartcard/wx/APDUTracerPanel.py 2009-11-22 16:47:03 UTC (rev 356)
@@ -54,7 +54,7 @@
def update( self, cardconnection, ccevent ):
'''CardConnectionObserver callback.'''
- apduline = ""
+ apduline = ""
if 'connect'==ccevent.type:
apduline += 'connecting to ' + cardconnection.getReader()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 16:56:48
|
Revision: 357
http://pyscard.svn.sourceforge.net/pyscard/?rev=357&view=rev
Author: ludov
Date: 2009-11-22 16:56:41 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E701 multiple statements on one line (colon)
Modified Paths:
--------------
trunk/pyscard/src/smartcard/ATR.py
trunk/pyscard/src/smartcard/CardMonitoring.py
trunk/pyscard/src/smartcard/CardNames.py
trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py
trunk/pyscard/src/smartcard/Observer.py
trunk/pyscard/src/smartcard/ReaderMonitoring.py
trunk/pyscard/src/smartcard/Synchronization.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py
trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py
trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py
trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py
Modified: trunk/pyscard/src/smartcard/ATR.py
===================================================================
--- trunk/pyscard/src/smartcard/ATR.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/ATR.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -94,10 +94,14 @@
self.TC += [None]
self.TD += [None]
- if self.hasTA[n]: self.TA[n]=self.bytes[ offset+self.hasTA[n] ]
- if self.hasTB[n]: self.TB[n]=self.bytes[ offset+self.hasTA[n]+self.hasTB[n] ]
- if self.hasTC[n]: self.TC[n]=self.bytes[ offset+self.hasTA[n]+self.hasTB[n]+self.hasTC[n] ]
- if self.hasTD[n]: self.TD[n]=self.bytes[ offset+self.hasTA[n]+self.hasTB[n]+self.hasTC[n]+self.hasTD[n] ]
+ if self.hasTA[n]:
+ self.TA[n]=self.bytes[ offset+self.hasTA[n] ]
+ if self.hasTB[n]:
+ self.TB[n]=self.bytes[ offset+self.hasTA[n]+self.hasTB[n] ]
+ if self.hasTC[n]:
+ self.TC[n]=self.bytes[ offset+self.hasTA[n]+self.hasTB[n]+self.hasTC[n] ]
+ if self.hasTD[n]:
+ self.TD[n]=self.bytes[ offset+self.hasTA[n]+self.hasTB[n]+self.hasTC[n]+self.hasTD[n] ]
self.interfaceBytesCount += self.hasTA[n]+self.hasTB[n]+self.hasTC[n]+self.hasTD[n]
TD=self.TD[n]
@@ -241,10 +245,14 @@
"""Dump the details of an ATR."""
for i in range( 0, len(self.TA) ):
- if self.TA[i]!=None: print "TA%d: %x" % (i+1,self.TA[i])
- if self.TB[i]!=None: print "TB%d: %x" % (i+1,self.TB[i])
- if self.TC[i]!=None: print "TC%d: %x" % (i+1,self.TC[i])
- if self.TD[i]!=None: print "TD%d: %x" % (i+1,self.TD[i])
+ if self.TA[i]!=None:
+ print "TA%d: %x" % (i+1,self.TA[i])
+ if self.TB[i]!=None:
+ print "TB%d: %x" % (i+1,self.TB[i])
+ if self.TC[i]!=None:
+ print "TC%d: %x" % (i+1,self.TC[i])
+ if self.TD[i]!=None:
+ print "TD%d: %x" % (i+1,self.TD[i])
print 'supported protocols', self.getSupportedProtocols()
print 'T=0 supported', self.isT0Supported()
Modified: trunk/pyscard/src/smartcard/CardMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/CardMonitoring.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/CardMonitoring.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -174,8 +174,10 @@
# by the __del__() method may already have been deleted.
# this causes ReaderMonitoringThread.run() to except with a TypeError
# or AttributeError
- except TypeError: pass
- except AttributeError: pass
+ except TypeError:
+ pass
+ except AttributeError:
+ pass
except:
try:
Modified: trunk/pyscard/src/smartcard/CardNames.py
===================================================================
--- trunk/pyscard/src/smartcard/CardNames.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/CardNames.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -67,7 +67,8 @@
def find( self, atr, reader=None ):
for k,v in self.db.iteritems():
- if loads(v).matches( atr, reader ): return k
+ if loads(v).matches( atr, reader ):
+ return k
synchronize( __CardNames__, "add delete dump find" )
Modified: trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -42,7 +42,8 @@
while True:
if isinstance( component, smartcard.pcsc.PCSCCardConnection.PCSCCardConnection ):
pcscprotocol = PCSCCardConnection.translateprotocolmask( protocol )
- if 0==pcscprotocol: pcscprotocol = component.getProtocol()
+ if 0==pcscprotocol:
+ pcscprotocol = component.getProtocol()
if None!=component.hcard:
hresult = SCardDisconnect( component.hcard, SCARD_LEAVE_CARD )
Modified: trunk/pyscard/src/smartcard/Observer.py
===================================================================
--- trunk/pyscard/src/smartcard/Observer.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/Observer.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -44,7 +44,8 @@
self.mutex.acquire()
try:
- if not self.changed: return
+ if not self.changed:
+ return
# Make a local copy in case of synchronous
# additions of observers:
localArray = self.obs[:]
@@ -55,11 +56,16 @@
for observer in localArray:
observer.update(self, arg)
- def deleteObservers(self): self.obs = []
- def setChanged(self): self.changed = 1
- def clearChanged(self): self.changed = 0
- def hasChanged(self): return self.changed
- def countObservers(self): return len(self.obs)
+ def deleteObservers(self):
+ self.obs = []
+ def setChanged(self):
+ self.changed = 1
+ def clearChanged(self):
+ self.changed = 0
+ def hasChanged(self):
+ return self.changed
+ def countObservers(self):
+ return len(self.obs)
synchronize(Observable,
"addObserver deleteObserver deleteObservers " +
Modified: trunk/pyscard/src/smartcard/ReaderMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/ReaderMonitoring.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/ReaderMonitoring.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -167,7 +167,8 @@
if addedReaders or removedReaders:
# Notify observers
self.readers=[]
- for r in currentReaders: self.readers.append(r)
+ for r in currentReaders:
+ self.readers.append(r)
self.observable.setChanged()
self.observable.notifyObservers((addedReaders, removedReaders))
Modified: trunk/pyscard/src/smartcard/Synchronization.py
===================================================================
--- trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -24,7 +24,8 @@
"""Synchronize methods in the given class.
Only synchronize the methods whose names are
given, or all methods if names=None."""
- if type(names)==type(''): names = names.split()
+ if type(names)==type(''):
+ names = names.split()
for (name, val) in klass.__dict__.items():
if callable(val) and name != '__init__' and \
(names == None or name in names):
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -90,9 +90,11 @@
If mode is not specified, connect with SCARD_SHARE_SHARED."""
CardConnection.connect( self, protocol )
pcscprotocol = translateprotocolmask( protocol )
- if 0==pcscprotocol: pcscprotocol = self.getProtocol()
+ if 0==pcscprotocol:
+ pcscprotocol = self.getProtocol()
- if mode==None: mode = SCARD_SHARE_SHARED
+ if mode==None:
+ mode = SCARD_SHARE_SHARED
hresult, self.hcard, dwActiveProtocol = SCardConnect(
self.hcontext, str(self.reader), mode, pcscprotocol )
if hresult!=0:
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardRequest.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -107,8 +107,10 @@
# for non infinite timeout, a timer will signal the end of the time-out by setting the evt event
evt = threading.Event()
- if INFINITE==self.timeout: timertimeout=1
- else: timertimeout=self.timeout
+ if INFINITE==self.timeout:
+ timertimeout=1
+ else:
+ timertimeout=self.timeout
timer = threading.Timer( timertimeout, signalEvent, [evt, INFINITE==self.timeout] )
# create a dictionary entry for new readers
@@ -224,7 +226,8 @@
# update state dictionary
readerstates[readername] = ( readername, eventstate )
- if evt.isSet(): raise CardRequestTimeoutException()
+ if evt.isSet():
+ raise CardRequestTimeoutException()
@@ -235,8 +238,10 @@
evt = threading.Event()
# for non infinite timeout, a timer will signal the end of the time-out
- if INFINITE==self.timeout: timertimeout=1
- else: timertimeout=self.timeout
+ if INFINITE==self.timeout:
+ timertimeout=1
+ else:
+ timertimeout=self.timeout
timer = threading.Timer( timertimeout, signalEvent, [evt, INFINITE==self.timeout] )
# get status change until time-out, e.g. evt is set
@@ -301,7 +306,8 @@
presentcards.append( Card.Card( readername, atr ) )
return presentcards
- if evt.isSet(): raise CardRequestTimeoutException()
+ if evt.isSet():
+ raise CardRequestTimeoutException()
if __name__ == '__main__':
"""Small sample illustrating the use of PCSCCardRequest.py."""
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -38,7 +38,8 @@
"""
# in case we have a string instead of a list
- if isinstance( groups, type("")): groups=[groups]
+ if isinstance( groups, type("")):
+ groups=[groups]
hresult, readers = SCardListReaders( hcontext, groups )
if hresult!=0:
if hresult==SCARD_E_NO_READERS_AVAILABLE:
Modified: trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py
===================================================================
--- trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -83,8 +83,10 @@
except excClass, e:
return e
else:
- if hasattr(excClass,'__name__'): excName = excClass.__name__
- else: excName = str(excClass)
+ if hasattr(excClass,'__name__'):
+ excName = excClass.__name__
+ else:
+ excName = str(excClass)
raise self.failureException, excName
Modified: trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py
===================================================================
--- trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -80,8 +80,10 @@
mutexvreaders.acquire()
if newreader not in virtualreaders:
virtualreaders.append( newreader )
- if insertedreaderstats.has_key(newreader): insertedreaderstats[newreader]+=1
- else: insertedreaderstats[newreader]=1
+ if insertedreaderstats.has_key(newreader):
+ insertedreaderstats[newreader]+=1
+ else:
+ insertedreaderstats[newreader]=1
finally:
readerEvent.clear()
mutexvreaders.release()
@@ -100,8 +102,10 @@
if virtualreaders:
oldreader=random.choice( virtualreaders )
virtualreaders.remove(oldreader)
- if removedreaderstats.has_key(oldreader): removedreaderstats[oldreader]+=1
- else: removedreaderstats[oldreader]=1
+ if removedreaderstats.has_key(oldreader):
+ removedreaderstats[oldreader]+=1
+ else:
+ removedreaderstats[oldreader]=1
finally:
readerEvent.clear()
mutexvreaders.release()
@@ -117,11 +121,15 @@
def update( self, observable, (addedreaders, removedreaders) ):
self.countnotified+=1
for newreader in addedreaders:
- if self.insertedreaderstats.has_key(newreader): self.insertedreaderstats[newreader]+=1
- else: self.insertedreaderstats[newreader]=1
+ if self.insertedreaderstats.has_key(newreader):
+ self.insertedreaderstats[newreader]+=1
+ else:
+ self.insertedreaderstats[newreader]=1
for oldreader in removedreaders:
- if self.removedreaderstats.has_key(oldreader): self.removedreaderstats[oldreader]+=1
- else: self.removedreaderstats[oldreader]=1
+ if self.removedreaderstats.has_key(oldreader):
+ self.removedreaderstats[oldreader]+=1
+ else:
+ self.removedreaderstats[oldreader]=1
class testcase_readermonitorstress( unittest.TestCase ):
Modified: trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py
===================================================================
--- trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py 2009-11-22 16:47:03 UTC (rev 356)
+++ trunk/pyscard/src/smartcard/test/manual/testcase_manualCardRequest.py 2009-11-22 16:56:41 UTC (rev 357)
@@ -43,17 +43,21 @@
print 'insert two smartcard readers'
while True:
readerz=readers()
- if 2<=len( readerz ): break
+ if 2<=len( readerz ):
+ break
time.sleep(.3)
-for reader in readerz: print '\t', reader
+for reader in readerz:
+ print '\t', reader
print 'insert two cards in the readers'
cardrequest = CardRequest()
while True:
cardz=cardrequest.waitforcardevent()
- if 2<=len( cardz ): break
+ if 2<=len( cardz ):
+ break
time.sleep(.3)
-for card in cardz: print '\t', toHexString(card.atr)
+for card in cardz:
+ print '\t', toHexString(card.atr)
#
@@ -74,7 +78,8 @@
cardrequest = CardRequest()
while True:
cards=cardrequest.waitforcardevent()
- if 0==len( cards ): break
+ if 0==len( cards ):
+ break
time.sleep(.3)
print 'ok'
@@ -173,7 +178,8 @@
_readerz=readers()
while True:
readerz=readers()
- if len(_readerz)>len( readerz ): break
+ if len(_readerz)>len( readerz ):
+ break
time.sleep(.1)
for reader in readerz:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2009-11-22 17:00:37
|
Revision: 358
http://pyscard.svn.sourceforge.net/pyscard/?rev=358&view=rev
Author: ludov
Date: 2009-11-22 17:00:29 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E111 indentation is not a multiple of four
Modified Paths:
--------------
trunk/pyscard/src/smartcard/Observer.py
trunk/pyscard/src/smartcard/Synchronization.py
trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
trunk/pyscard/src/smartcard/util/__init__.py
trunk/pyscard/src/smartcard/wx/__init__.py
Modified: trunk/pyscard/src/smartcard/Observer.py
===================================================================
--- trunk/pyscard/src/smartcard/Observer.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/Observer.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -8,67 +8,67 @@
for all smartcard package observers.
Known subclasses:
- smartcard.ReaderObserver
+ smartcard.ReaderObserver
"""
from smartcard.Synchronization import *
class Observer:
- def update(observable, arg):
- '''Called when the observed object is
- modified. You call an Observable object's
- notifyObservers method to notify all the
- object's observers of the change.'''
- pass
+ def update(observable, arg):
+ '''Called when the observed object is
+ modified. You call an Observable object's
+ notifyObservers method to notify all the
+ object's observers of the change.'''
+ pass
class Observable(Synchronization):
- def __init__(self):
- self.obs = []
- self.changed = 0
- Synchronization.__init__(self)
+ def __init__(self):
+ self.obs = []
+ self.changed = 0
+ Synchronization.__init__(self)
- def addObserver(self, observer):
- if observer not in self.obs:
- self.obs.append(observer)
+ def addObserver(self, observer):
+ if observer not in self.obs:
+ self.obs.append(observer)
- def deleteObserver(self, observer):
- self.obs.remove(observer)
+ def deleteObserver(self, observer):
+ self.obs.remove(observer)
- def notifyObservers(self, arg=None):
- '''If 'changed' indicates that this object
- has changed, notify all its observers, then
- call clearChanged(). Each observer has its
- update() called with two arguments: this
- observable object and the generic 'arg'.'''
+ def notifyObservers(self, arg=None):
+ '''If 'changed' indicates that this object
+ has changed, notify all its observers, then
+ call clearChanged(). Each observer has its
+ update() called with two arguments: this
+ observable object and the generic 'arg'.'''
- self.mutex.acquire()
- try:
- if not self.changed:
- return
- # Make a local copy in case of synchronous
- # additions of observers:
- localArray = self.obs[:]
- self.clearChanged()
- finally:
- self.mutex.release()
- # Update observers
- for observer in localArray:
- observer.update(self, arg)
+ self.mutex.acquire()
+ try:
+ if not self.changed:
+ return
+ # Make a local copy in case of synchronous
+ # additions of observers:
+ localArray = self.obs[:]
+ self.clearChanged()
+ finally:
+ self.mutex.release()
+ # Update observers
+ for observer in localArray:
+ observer.update(self, arg)
- def deleteObservers(self):
- self.obs = []
- def setChanged(self):
- self.changed = 1
- def clearChanged(self):
- self.changed = 0
- def hasChanged(self):
- return self.changed
- def countObservers(self):
- return len(self.obs)
+ def deleteObservers(self):
+ self.obs = []
+ def setChanged(self):
+ self.changed = 1
+ def clearChanged(self):
+ self.changed = 0
+ def hasChanged(self):
+ return self.changed
+ def countObservers(self):
+ return len(self.obs)
synchronize(Observable,
- "addObserver deleteObserver deleteObservers " +
- "setChanged clearChanged hasChanged " +
- "countObservers")
+ "addObserver deleteObserver deleteObservers " +
+ "setChanged clearChanged hasChanged " +
+ "countObservers")
#:~
Modified: trunk/pyscard/src/smartcard/Synchronization.py
===================================================================
--- trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -9,32 +9,32 @@
from threading import RLock
def synchronized(method):
- def f(*args):
- self = args[0]
- self.mutex.acquire()
- # print method.__name__, 'acquired'
- try:
- return apply(method, args)
- finally:
- self.mutex.release()
- # print method.__name__, 'released'
- return f
+ def f(*args):
+ self = args[0]
+ self.mutex.acquire()
+ # print method.__name__, 'acquired'
+ try:
+ return apply(method, args)
+ finally:
+ self.mutex.release()
+ # print method.__name__, 'released'
+ return f
def synchronize(klass, names=None):
- """Synchronize methods in the given class.
- Only synchronize the methods whose names are
- given, or all methods if names=None."""
- if type(names)==type(''):
- names = names.split()
- for (name, val) in klass.__dict__.items():
- if callable(val) and name != '__init__' and \
- (names == None or name in names):
- # print "synchronizing", name
- klass.__dict__[name] = synchronized(val)
+ """Synchronize methods in the given class.
+ Only synchronize the methods whose names are
+ given, or all methods if names=None."""
+ if type(names)==type(''):
+ names = names.split()
+ for (name, val) in klass.__dict__.items():
+ if callable(val) and name != '__init__' and \
+ (names == None or name in names):
+ # print "synchronizing", name
+ klass.__dict__[name] = synchronized(val)
# You can create your own self.mutex, or inherit
# from this class:
class Synchronization:
- def __init__(self):
- self.mutex = RLock()
+ def __init__(self):
+ self.mutex = RLock()
#:~
Modified: trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -46,7 +46,7 @@
# Where this link is in the chain:
location = self.chain.index(self)
if not self.end():
- return self.chain[location + 1]
+ return self.chain[location + 1]
def addFilterException( self, exClass ):
"""Add an exception filter to the error checking chain.
Modified: trunk/pyscard/src/smartcard/util/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/util/__init__.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/util/__init__.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -218,7 +218,7 @@
def BinStringToHexList( binstring ):
hexlist=[]
for byte in binstring:
- hexlist= hexlist + [ ord(byte) ]
+ hexlist= hexlist + [ ord(byte) ]
return hexlist
def hl2bs( hexlist ):
Modified: trunk/pyscard/src/smartcard/wx/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/__init__.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/wx/__init__.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -27,7 +27,7 @@
import sys
def main_is_frozen():
- return( hasattr( sys, "frozen" ) or hasattr( sys, "importers" ) or imp.is_frozen( "__main__") )
+ return( hasattr( sys, "frozen" ) or hasattr( sys, "importers" ) or imp.is_frozen( "__main__") )
ICO_SMARTCARD=None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2010-01-21 14:35:15
|
Revision: 368
http://pyscard.svn.sourceforge.net/pyscard/?rev=368&view=rev
Author: ludov
Date: 2010-01-21 14:34:40 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
connect() now have a new optionnal parameter disposition= passed to
SCardDisconnect(). The default value is SCARD_UNPOWER_CARD as before.
It is now possible to disconnect from a card without resetting the card
using disposition=SCARD_LEAVE_CARD
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnectionDecorator.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2010-01-02 20:56:18 UTC (rev 367)
+++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2010-01-21 14:34:40 UTC (rev 368)
@@ -48,9 +48,9 @@
"""call inner component deleteObserver"""
self.component.deleteObserver( observer )
- def connect( self, protocol=None, mode=None ):
+ def connect( self, protocol=None, mode=None, disposition=None ):
"""call inner component connect"""
- self.component.connect( protocol, mode )
+ self.component.connect( protocol, mode, disposition )
def disconnect( self ):
"""call inner component disconnect"""
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2010-01-02 20:56:18 UTC (rev 367)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2010-01-21 14:34:40 UTC (rev 368)
@@ -82,7 +82,7 @@
raise CardConnectionException( 'Failed to release context: ' + SCardGetErrorMessage(hresult) )
CardConnection.__del__( self )
- def connect( self, protocol=None, mode=None ):
+ def connect( self, protocol=None, mode=None, disposition=None ):
"""Connect to the card.
If protocol is not specified, connect with the default connection protocol.
@@ -95,6 +95,12 @@
if mode==None:
mode = SCARD_SHARE_SHARED
+
+ # store the way to dispose the card
+ if disposition==None:
+ disposition = SCARD_UNPOWER_CARD
+ self.disposition = disposition
+
hresult, self.hcard, dwActiveProtocol = SCardConnect(
self.hcontext, str(self.reader), mode, pcscprotocol )
if hresult!=0:
@@ -121,7 +127,7 @@
except TypeError:
pass
if None!=self.hcard:
- hresult = SCardDisconnect( self.hcard, SCARD_UNPOWER_CARD )
+ hresult = SCardDisconnect( self.hcard, self.disposition )
if hresult!=0:
raise CardConnectionException( 'Failed to disconnect: ' + SCardGetErrorMessage(hresult) )
self.hcard = None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2010-02-05 21:11:32
|
Revision: 370
http://pyscard.svn.sourceforge.net/pyscard/?rev=370&view=rev
Author: ludov
Date: 2010-02-05 21:11:26 +0000 (Fri, 05 Feb 2010)
Log Message:
-----------
Fix pep8 E231 missing whitespace after ','
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardNames.py
trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py
trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
Modified: trunk/pyscard/src/smartcard/CardNames.py
===================================================================
--- trunk/pyscard/src/smartcard/CardNames.py 2010-02-05 20:10:23 UTC (rev 369)
+++ trunk/pyscard/src/smartcard/CardNames.py 2010-02-05 21:11:26 UTC (rev 370)
@@ -62,11 +62,11 @@
pass
def dump( self ):
- for k,v in self.db.iteritems():
+ for k, v in self.db.iteritems():
print k, `loads(v)`
def find( self, atr, reader=None ):
- for k,v in self.db.iteritems():
+ for k, v in self.db.iteritems():
if loads(v).matches( atr, reader ):
return k
Modified: trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py 2010-02-05 20:10:23 UTC (rev 369)
+++ trunk/pyscard/src/smartcard/Examples/framework/sample_ATR.py 2010-02-05 21:11:26 UTC (rev 370)
@@ -27,7 +27,8 @@
from smartcard.util import toHexString
atr = ATR([0x3B, 0x9E, 0x95, 0x80, 0x1F, 0xC3, 0x80, 0x31, 0xA0, 0x73,
- 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81,0xCD,0xB9] )
+ 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81,
+ 0xCD, 0xB9] )
print atr
print 'historical bytes: ', toHexString( atr.getHistoricalBytes() )
Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2010-02-05 20:10:23 UTC (rev 369)
+++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2010-02-05 21:11:26 UTC (rev 370)
@@ -35,7 +35,7 @@
apppanel=SampleAPDUManagerPanel,
appstyle=TR_SMARTCARD | TR_READER | PANEL_APDUTRACER,
appicon=os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
- size=(800,600) )
+ size=(800, 600) )
app.MainLoop()
if __name__ == "__main__":
Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2010-02-05 20:10:23 UTC (rev 369)
+++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2010-02-05 21:11:26 UTC (rev 370)
@@ -91,7 +91,7 @@
apppanel=SamplePanel,
appstyle=TR_SMARTCARD | TR_READER,
appicon=os.path.join( os.path.dirname( __file__ ), 'images', 'mysmartcard.ico' ),
- size=(800,600) )
+ size=(800, 600) )
app.MainLoop()
if __name__ == "__main__":
Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py
===================================================================
--- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2010-02-05 20:10:23 UTC (rev 369)
+++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2010-02-05 21:11:26 UTC (rev 370)
@@ -32,7 +32,7 @@
apppanel=None,
appstyle=TR_READER,
appicon=os.path.join( os.path.dirname( __file__ ), 'images', 'readerviewer.ico' ),
- size=(800,600) )
+ size=(800, 600) )
app.MainLoop()
if __name__ == "__main__":
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jda...@us...> - 2010-04-20 15:45:26
|
Revision: 396
http://pyscard.svn.sourceforge.net/pyscard/?rev=396&view=rev
Author: jdaussel
Date: 2010-04-20 15:45:17 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Moved handling of ScardGetStatusChange() in python layer
Modified Paths:
--------------
trunk/pyscard/src/smartcard/ChangeLog
trunk/pyscard/src/smartcard/scard/scard.i
Modified: trunk/pyscard/src/smartcard/ChangeLog
===================================================================
--- trunk/pyscard/src/smartcard/ChangeLog 2010-04-20 15:39:27 UTC (rev 395)
+++ trunk/pyscard/src/smartcard/ChangeLog 2010-04-20 15:45:17 UTC (rev 396)
@@ -9,8 +9,12 @@
* rename FEATURE_MCT_READERDIRECT in FEATURE_MCT_READER_DIRECT to be conform with PCSC v2 part 10 ch. 2.3 (Ludovic Rousseau)
* added missing CARD_E_NO_READERS_AVAILABLE (Kjell Tore Fossbakk)
* added support of x86_64 on Mac OS X Snow Leopard (Jakob Schlyter)
+ * ATR can be passed in input in the reader state list (Benoit Allard)
+ * clear state changed bit in waitforcard/waitforcardevent upon time-out or reader removal (Jean-Daniel Aussel)
+ * removed clearing of states and ATR content upon SCardGetStatusChange() error (Benoit Allard); handling is now moved up in python framework (Jean-Daniel Aussel)
+
1.6.8 (July 2009)
=================
* fixed SCARD_ERROR types to match correct types on linux and Mac OS X (Ludovic Rousseau)
Modified: trunk/pyscard/src/smartcard/scard/scard.i
===================================================================
--- trunk/pyscard/src/smartcard/scard/scard.i 2010-04-20 15:39:27 UTC (rev 395)
+++ trunk/pyscard/src/smartcard/scard/scard.i 2010-04-20 15:45:17 UTC (rev 396)
@@ -558,21 +558,6 @@
// printf( "%.8lx %.8lx ", prsl->ars[i].dwCurrentState, prsl->ars[i].dwEventState );
//}
- // there was a time-out or we asked for an unexisting reader
- // in this case, the output values of the READERSTATELIST are meaningless
- if( SCARD_E_TIMEOUT==hresult || SCARD_E_UNKNOWN_READER==hresult)
- {
- // for each state, output event state is input event state, and nuke ATR if no card present
- for( i=0; i<prsl->cRStates; i++ )
- {
- // remove changed bit
- prsl->ars[i].dwEventState = prsl->ars[i].dwCurrentState;
-
- // ATR not valid on output
- prsl->ars[i].cbAtr=0;
- }
- }
-
return hresult;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jda...@us...> - 2010-04-21 14:34:04
|
Revision: 398
http://pyscard.svn.sourceforge.net/pyscard/?rev=398&view=rev
Author: jdaussel
Date: 2010-04-21 14:33:55 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Propagate disposition parameter to CardConnection and CardConnectionDecorators
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2010-04-20 19:21:09 UTC (rev 397)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2010-04-21 14:33:55 UTC (rev 398)
@@ -70,7 +70,7 @@
"""Remove a CardConnection observer."""
Observable.deleteObserver( self, observer )
- def connect( self, protocol=None, mode=None ):
+ def connect( self, protocol=None, mode=None, disposition=None ):
"""Connect to card.
protocol: a bit mask of the protocols to use, from CardConnection.T0_protocol, CardConnection.T1_protocol,
CardConnection.RAW_protocol, CardConnection.T15_protocol
Modified: trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py 2010-04-20 19:21:09 UTC (rev 397)
+++ trunk/pyscard/src/smartcard/ExclusiveConnectCardConnection.py 2010-04-21 14:33:55 UTC (rev 398)
@@ -35,9 +35,9 @@
def __init__( self, cardconnection ):
CardConnectionDecorator.__init__( self, cardconnection )
- def connect( self, protocol=None, mode=None ):
+ def connect( self, protocol=None, mode=None, disposition=None ):
'''Disconnect and reconnect in exclusive mode PCSCCardconnections.'''
- CardConnectionDecorator.connect( self, protocol, mode )
+ CardConnectionDecorator.connect( self, protocol, mode, disposition )
component=self.component
while True:
if isinstance( component, smartcard.pcsc.PCSCCardConnection.PCSCCardConnection ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2010-06-09 08:03:07
|
Revision: 450
http://pyscard.svn.sourceforge.net/pyscard/?rev=450&view=rev
Author: ludov
Date: 2010-06-09 08:02:58 +0000 (Wed, 09 Jun 2010)
Log Message:
-----------
make pep8 happy
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnectionEvent.py
trunk/pyscard/src/smartcard/CardMonitoring.py
Modified: trunk/pyscard/src/smartcard/CardConnectionEvent.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionEvent.py 2010-06-09 07:55:12 UTC (rev 449)
+++ trunk/pyscard/src/smartcard/CardConnectionEvent.py 2010-06-09 08:02:58 UTC (rev 450)
@@ -23,6 +23,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
+
class CardConnectionEvent:
"""Base class for card connection events.
@@ -33,6 +34,7 @@
command APDU byte list for 'command'
[response data, sw1, sw2] for 'response'
type: 'connect' args:"""
- def __init__( self, type, args=None):
- self.type=type
- self.args=args
+
+ def __init__(self, type, args=None):
+ self.type = type
+ self.args = args
Modified: trunk/pyscard/src/smartcard/CardMonitoring.py
===================================================================
--- trunk/pyscard/src/smartcard/CardMonitoring.py 2010-06-09 07:55:12 UTC (rev 449)
+++ trunk/pyscard/src/smartcard/CardMonitoring.py 2010-06-09 08:02:58 UTC (rev 450)
@@ -40,17 +40,20 @@
from smartcard.CardType import AnyCardType
from smartcard.CardRequest import CardRequest
-_START_ON_DEMAND_=False
+_START_ON_DEMAND_ = False
+
# CardObserver interface
class CardObserver(Observer):
"""
CardObserver is a base abstract class for objects that are to be notified
upon smartcard reader insertion/removal.
"""
+
def __init__(self):
pass
- def update( self, observable, (addedcards, removedcards) ):
+
+ def update(self, observable, (addedcards, removedcards)):
"""Called upon reader insertion/removal.
observable:
@@ -59,6 +62,7 @@
"""
pass
+
class CardMonitor:
"""Class that monitors smart card insertion/removal.
and notify observers
@@ -73,45 +77,46 @@
there is only one CardMonitor.
"""
- class __CardMonitorSingleton( Observable ):
+ class __CardMonitorSingleton(Observable):
"""The real smartcard monitor class.
A single instance of this class is created
by the public CardMonitor class.
"""
- def __init__( self ):
+
+ def __init__(self):
Observable.__init__(self)
if _START_ON_DEMAND_:
- self.rmthread=None
+ self.rmthread = None
else:
- self.rmthread = CardMonitoringThread( self )
+ self.rmthread = CardMonitoringThread(self)
- def addObserver( self, observer ):
+ def addObserver(self, observer):
"""Add an observer.
We only start the card monitoring thread when
there are observers.
"""
- Observable.addObserver( self, observer )
+ Observable.addObserver(self, observer)
if _START_ON_DEMAND_:
- if self.countObservers()>0 and self.rmthread==None:
- self.rmthread = CardMonitoringThread( self )
+ if self.countObservers() > 0 and self.rmthread == None:
+ self.rmthread = CardMonitoringThread(self)
else:
- observer.update( self, (self.rmthread.cards, [] ) )
+ observer.update(self, (self.rmthread.cards, []))
- def deleteObserver( self, observer ):
+ def deleteObserver(self, observer):
"""Remove an observer.
We delete the CardMonitoringThread reference when there
are no more observers.
"""
- Observable.deleteObserver( self, observer )
+ Observable.deleteObserver(self, observer)
if _START_ON_DEMAND_:
- if self.countObservers()==0:
- if self.rmthread!=None:
- self.rmthread=None
+ if self.countObservers() == 0:
+ if self.rmthread != None:
+ self.rmthread = None
- def __str__( self ):
+ def __str__(self):
return 'CardMonitor'
# the singleton
@@ -121,8 +126,8 @@
if not CardMonitor.instance:
CardMonitor.instance = CardMonitor.__CardMonitorSingleton()
- def __getattr__( self, name ):
- return getattr( self.instance, name )
+ def __getattr__(self, name):
+ return getattr(self.instance, name)
class CardMonitoringThread:
@@ -130,15 +135,16 @@
This thread waits for card insertion.
"""
- class __CardMonitoringThreadSingleton( Thread ):
+ class __CardMonitoringThreadSingleton(Thread):
"""The real card monitoring thread class.
A single instance of this class is created
by the public CardMonitoringThread class.
"""
+
def __init__(self, observable):
Thread.__init__(self)
- self.observable=observable
+ self.observable = observable
self.stopEvent = Event()
self.stopEvent.clear()
self.cards = []
@@ -149,31 +155,32 @@
"""Runs until stopEvent is notified, and notify
observers of all card insertion/removal.
"""
- self.cardrequest = CardRequest( timeout=0.1 )
- while self.stopEvent.isSet()!=1:
+ self.cardrequest = CardRequest(timeout=0.1)
+ while self.stopEvent.isSet() != 1:
try:
currentcards = self.cardrequest.waitforcardevent()
- addedcards=[]
+ addedcards = []
for card in currentcards:
- if not self.cards.__contains__( card ):
- addedcards.append( card )
+ if not self.cards.__contains__(card):
+ addedcards.append(card)
- removedcards=[]
+ removedcards = []
for card in self.cards:
- if not currentcards.__contains__( card ):
- removedcards.append( card )
+ if not currentcards.__contains__(card):
+ removedcards.append(card)
- if addedcards!=[] or removedcards!=[]:
- self.cards=currentcards
+ if addedcards != [] or removedcards != []:
+ self.cards = currentcards
self.observable.setChanged()
- self.observable.notifyObservers( (addedcards, removedcards) )
+ self.observable.notifyObservers((addedcards, removedcards))
- # when CardMonitoringThread.__del__() is invoked in response to shutdown,
- # e.g., when execution of the program is done, other globals referenced
- # by the __del__() method may already have been deleted.
- # this causes ReaderMonitoringThread.run() to except with a TypeError
- # or AttributeError
+ # when CardMonitoringThread.__del__() is invoked in
+ # response to shutdown, e.g., when execution of the
+ # program is done, other globals referenced by the
+ # __del__() method may already have been deleted.
+ # this causes ReaderMonitoringThread.run() to except
+ # with a TypeError or AttributeError
except TypeError:
pass
except AttributeError:
@@ -197,16 +204,15 @@
def __init__(self, observable):
if not CardMonitoringThread.instance:
- CardMonitoringThread.instance = CardMonitoringThread.__CardMonitoringThreadSingleton( observable )
+ CardMonitoringThread.instance = CardMonitoringThread.__CardMonitoringThreadSingleton(observable)
CardMonitoringThread.instance.start()
-
- def __getattr__( self, name ):
+ def __getattr__(self, name):
if self.instance:
- return getattr( self.instance, name )
+ return getattr(self.instance, name)
- # commented to avoid bad clean-up sequence of python where __del__ is called when
- # some objects it uses are already gargabe collected
+ # commented to avoid bad clean-up sequence of python where __del__
+ # is called when some objects it uses are already gargabe collected
#def __del__(self):
# if CardMonitoringThread.instance!=None:
# CardMonitoringThread.instance.stop()
@@ -218,24 +224,26 @@
print 'insert or remove cards in the next 10 seconds'
# a simple card observer that prints added/removed cards
- class printobserver( CardObserver ):
- def __init__( self, obsindex ):
- self.obsindex=obsindex
+ class printobserver(CardObserver):
- def update( self, observable, (addedcards, removedcards) ):
+ def __init__(self, obsindex):
+ self.obsindex = obsindex
+
+ def update(self, observable, (addedcards, removedcards)):
print "%d - added: " % self.obsindex, addedcards
print "%d - removed: " % self.obsindex, removedcards
- class testthread( Thread ):
- def __init__(self, obsindex ):
+ class testthread(Thread):
+
+ def __init__(self, obsindex):
Thread.__init__(self)
self.readermonitor = CardMonitor()
self.obsindex = obsindex
- self.observer=None
+ self.observer = None
def run(self):
# create and register observer
- self.observer = printobserver( self.obsindex )
+ self.observer = printobserver(self.obsindex)
self.readermonitor.addObserver(self.observer)
sleep(10)
self.readermonitor.deleteObserver(self.observer)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jda...@us...> - 2010-06-23 16:39:40
|
Revision: 500
http://pyscard.svn.sourceforge.net/pyscard/?rev=500&view=rev
Author: jdaussel
Date: 2010-06-23 16:39:34 +0000 (Wed, 23 Jun 2010)
Log Message:
-----------
readers() method is now a staticmethod of the PCSCReader class
Modified Paths:
--------------
trunk/pyscard/src/smartcard/System.py
trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
Modified: trunk/pyscard/src/smartcard/System.py
===================================================================
--- trunk/pyscard/src/smartcard/System.py 2010-06-23 12:27:32 UTC (rev 499)
+++ trunk/pyscard/src/smartcard/System.py 2010-06-23 16:39:34 UTC (rev 500)
@@ -38,7 +38,7 @@
r=smartcard.readers(['SCard$DefaultReaders', 'MyReaderGroup'])
"""
- return smartcard.pcsc.PCSCReader.readers(groups)
+ return smartcard.pcsc.PCSCReader.PCSCReader.readers(groups)
def readergroups():
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2010-06-23 12:27:32 UTC (rev 499)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2010-06-23 16:39:34 UTC (rev 500)
@@ -83,9 +83,11 @@
if 0 != hresult:
raise EstablishContextException(hresult)
try:
- hresult = SCardRemoveReaderFromGroup(hcontext, self.name, groupname)
+ hresult = SCardRemoveReaderFromGroup(hcontext, self.name,
+ groupname)
if 0 != hresult:
- raise RemoveReaderFromGroupException(hresult, self.name, groupname)
+ raise RemoveReaderFromGroupException(hresult, self.name,
+ groupname)
finally:
hresult = SCardReleaseContext(hcontext)
if 0 != hresult:
@@ -100,21 +102,29 @@
def create(self, readername):
return PCSCReader(readername)
+ def readers(groups=[]):
+ creaders = []
+ hcontext = PCSCContext().getContext()
-def readers(groups=[]):
- creaders = []
- hcontext = PCSCContext().getContext()
+ for reader in __PCSCreaders__(hcontext, groups):
+ creaders.append(ReaderFactory.createReader(
+ 'smartcard.pcsc.PCSCReader.PCSCReader', reader))
+ return creaders
+ readers = staticmethod(readers)
- for reader in __PCSCreaders__(hcontext, groups):
- creaders.append(ReaderFactory.createReader('smartcard.pcsc.PCSCReader.PCSCReader', reader))
- return creaders
-
if __name__ == '__main__':
+ from smartcard.util import *
SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
DF_TELECOM = [0x7F, 0x10]
- creaders = readers()
- cc = creaders[0].createConnection()
- cc.connect()
- data, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM)
- print "%X %X" % (sw1, sw2)
+ creaders = PCSCReader.readers()
+ for reader in creaders:
+ try:
+ print reader.name
+ connection = reader.createConnection()
+ connection.connect()
+ print toHexString(connection.getATR())
+ data, sw1, sw2 = connection.transmit(SELECT + DF_TELECOM)
+ print "%X %X" % (sw1, sw2)
+ except NoCardException, x:
+ print 'no card in reader'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jda...@us...> - 2010-06-23 17:05:44
|
Revision: 501
http://pyscard.svn.sourceforge.net/pyscard/?rev=501&view=rev
Author: jdaussel
Date: 2010-06-23 17:05:38 +0000 (Wed, 23 Jun 2010)
Log Message:
-----------
Reader list is now created by ReaderFactory static method
Modified Paths:
--------------
trunk/pyscard/src/smartcard/System.py
trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
trunk/pyscard/src/smartcard/reader/ReaderFactory.py
Modified: trunk/pyscard/src/smartcard/System.py
===================================================================
--- trunk/pyscard/src/smartcard/System.py 2010-06-23 16:39:34 UTC (rev 500)
+++ trunk/pyscard/src/smartcard/System.py 2010-06-23 17:05:38 UTC (rev 501)
@@ -24,7 +24,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
-import smartcard.pcsc.PCSCReader
+import smartcard.reader.ReaderFactory
import smartcard.pcsc.PCSCReaderGroups
@@ -38,7 +38,7 @@
r=smartcard.readers(['SCard$DefaultReaders', 'MyReaderGroup'])
"""
- return smartcard.pcsc.PCSCReader.PCSCReader.readers(groups)
+ return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
def readergroups():
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReader.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2010-06-23 16:39:34 UTC (rev 500)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCReader.py 2010-06-23 17:05:38 UTC (rev 501)
@@ -23,7 +23,6 @@
"""
from smartcard.CardConnectionDecorator import CardConnectionDecorator
-from smartcard.reader.ReaderFactory import ReaderFactory
from smartcard.reader.Reader import Reader
from smartcard.pcsc.PCSCContext import PCSCContext
from smartcard.pcsc.PCSCCardConnection import PCSCCardConnection
@@ -99,16 +98,16 @@
class Factory:
- def create(self, readername):
+ def create(readername):
return PCSCReader(readername)
+ create = staticmethod(create)
def readers(groups=[]):
creaders = []
hcontext = PCSCContext().getContext()
for reader in __PCSCreaders__(hcontext, groups):
- creaders.append(ReaderFactory.createReader(
- 'smartcard.pcsc.PCSCReader.PCSCReader', reader))
+ creaders.append(PCSCReader.Factory.create(reader))
return creaders
readers = staticmethod(readers)
Modified: trunk/pyscard/src/smartcard/reader/ReaderFactory.py
===================================================================
--- trunk/pyscard/src/smartcard/reader/ReaderFactory.py 2010-06-23 16:39:34 UTC (rev 500)
+++ trunk/pyscard/src/smartcard/reader/ReaderFactory.py 2010-06-23 17:05:38 UTC (rev 501)
@@ -31,18 +31,15 @@
"""
from smartcard.ClassLoader import get_class
+from smartcard.pcsc.PCSCReader import PCSCReader
class ReaderFactory:
"""Class to create readers from reader type id."""
factories = {}
+ factorymethods = [PCSCReader.readers]
- def addFactory(id, ReaderFactory):
- """Static method to add a ReaderFactory associated to a reader id."""
- ReaderFactory.factories.put[id] = ReaderFactory
- addFactory = staticmethod(addFactory)
-
# A Template Method:
def createReader(clazz, readername):
"""Static method to create a reader from a reader clazz.
@@ -55,3 +52,10 @@
ReaderFactory.factories[clazz] = get_class(clazz).Factory()
return ReaderFactory.factories[clazz].create(readername)
createReader = staticmethod(createReader)
+
+ def readers(groups=[]):
+ zreaders = []
+ for fm in ReaderFactory.factorymethods:
+ zreaders += fm(groups)
+ return zreaders
+ readers = staticmethod(readers)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jda...@us...> - 2010-08-18 13:40:58
|
Revision: 509
http://pyscard.svn.sourceforge.net/pyscard/?rev=509&view=rev
Author: jdaussel
Date: 2010-08-18 13:40:51 +0000 (Wed, 18 Aug 2010)
Log Message:
-----------
Added partial support of remote pcsc readers with pyro
Added Paths:
-----------
trunk/pyscard/src/smartcard/pyro/
trunk/pyscard/src/smartcard/pyro/PyroReader.py
trunk/pyscard/src/smartcard/pyro/__init__.py
trunk/pyscard/src/smartcard/pyro/server/
trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py
trunk/pyscard/src/smartcard/pyro/server/PyroEventServer.py
trunk/pyscard/src/smartcard/pyro/server/PyroNameServer.py
trunk/pyscard/src/smartcard/pyro/server/RemoteCardConnection.py
trunk/pyscard/src/smartcard/pyro/server/RemoteReaderServer.py
trunk/pyscard/src/smartcard/pyro/server/__init__.py
Added: trunk/pyscard/src/smartcard/pyro/PyroReader.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/PyroReader.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/PyroReader.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1,90 @@
+"""PyroReaderClient: concrete reader class for Remote Readers
+
+__author__ = "gemalto http://www.gemalto.com"
+
+Copyright 2001-2010 gemalto
+Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+pyscard is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+
+import Pyro.core
+import Pyro.naming
+
+from smartcard.Exceptions import CardConnectionException, NoCardException
+from smartcard.reader.Reader import Reader
+from smartcard.reader.ReaderFactory import ReaderFactory
+
+class PyroReader(Reader):
+ """Remote reader class."""
+ def __init__( self, readername ):
+ """Constructs a new Remote Reader client implementation from a Pyro URI."""
+ ns=Pyro.naming.NameServerLocator().getNS()
+ self.uri = ns.resolve(':pyscard.smartcard.readers.'+readername)
+ self.reader = Pyro.core.getAttrProxyForURI(self.uri)
+ self.name = self.reader.name
+
+ def addtoreadergroup( self, groupname ):
+ """Add reader to a reader group."""
+ self.reader.addtoreadergroup( groupname )
+
+ def removefromreadergroup( self, groupname ):
+ """Remove a reader from a reader group"""
+ self.reader.removefromreadergroup( groupname )
+
+ def createConnection( self ):
+ """Return a card connection thru a remote reader."""
+ uri = self.reader.createConnection()
+ return Pyro.core.getAttrProxyForURI(uri)
+
+ class Factory:
+ def create(readername):
+ return PyroReader( readername )
+ create = staticmethod(create)
+
+ def readers(groups=[]):
+ readernames = []
+ try:
+ ns=Pyro.naming.NameServerLocator().getNS()
+ readernames = ns.list(':pyscard.smartcard.readers')
+ except Pyro.errors.NamingError:
+ print 'Warning: pyro name server not found'
+
+ remotereaders=[]
+ for readername in readernames:
+ remotereaders.append( PyroReader.Factory.create(readername[0]) )
+
+ return remotereaders
+ readers = staticmethod(readers)
+
+if __name__ == '__main__':
+ SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ DF_TELECOM = [0x7F, 0x10]
+ from smartcard.util import *
+
+ remotereaders = PyroReader.readers()
+ for reader in remotereaders:
+ try:
+ print reader.name, ', uri: ', reader.uri
+ connection = reader.createConnection()
+ connection.connect()
+ print toHexString( connection.getATR() )
+ data, sw1, sw2 = connection.transmit(SELECT + DF_TELECOM)
+ print "%X %X" % (sw1, sw2)
+ except NoCardException,x:
+ print 'no card in reader'
+
Added: trunk/pyscard/src/smartcard/pyro/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/__init__.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/__init__.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1 @@
+
Added: trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1,92 @@
+"""PyroDaemon: Wrapper class around pyro daemon
+
+__author__ = "gemalto http://www.gemalto.com"
+
+Copyright 2001-2010 gemalto
+Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+pyscard is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+
+import signal
+from threading import Thread
+import time
+
+import Pyro.core
+import Pyro.naming
+
+class PyroDaemon:
+ """Singleton class to wrap the pyro daemon."""
+
+ class _PyroDaemon:
+ """The pyro daemon actual wrapper class.
+
+ A single instance of this class is created
+ by the public PyroDaemon class.
+ """
+ def __init__(self):
+ self.daemon = Pyro.core.Daemon()
+ self.handler = signal.signal( signal.SIGINT, self )
+ ns=Pyro.naming.NameServerLocator().getNS()
+ self.daemon.useNameServer(ns)
+
+ def __call__(self, signame, sf):
+ """Ctrl+c handler that will gracefully shutdown the server
+ upon Ctrl+C signal"""
+ print 'PyroDaemon Ctrl+C handler'
+ self.daemon.shutdown(True)
+ time.sleep(1)
+ self.handler( signame, sf )
+
+ def connect(self,object,name=None):
+ return self.daemon.connect(object,name)
+
+ def disconnect(self,object):
+ return self.daemon.disconnect(object)
+
+ def start(self):
+ """start pyro daemon."""
+ self.daemon.requestLoop()
+
+ # the singleton
+ instance = None
+
+ def __init__(self):
+ if not PyroDaemon.instance:
+ PyroDaemon.instance = PyroDaemon._PyroDaemon()
+
+ def __getattr__( self, name ):
+ return getattr( self.instance, name )
+
+class PyroDaemonThread(Thread):
+ """Thread running the Pyro daemon server.
+ """
+
+ def __init__(self):
+ """Initialize pyro event server with command line arguments.
+ For a complete list of command line arguments, see pyro documentation
+ for pyro-es start script."""
+ Thread.__init__( self )
+ self.setDaemon( True )
+ self.setName( 'smartcard.pyro.server.PyroDaemonThread' )
+ self.daemon = PyroDaemon()
+
+ def run(self):
+ """Starts Pyro daemon."""
+ self.daemon.start()
+
+
Added: trunk/pyscard/src/smartcard/pyro/server/PyroEventServer.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/server/PyroEventServer.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/server/PyroEventServer.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1,103 @@
+"""Utility class to start/stop Pyro Event Server.
+
+__author__ = "http://www.gemalto.com"
+
+Copyright 2001-2010 gemalto
+Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+pyscard is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+
+import signal
+import sys
+from threading import Thread
+import time
+
+import Pyro.EventService.Server
+import Pyro.naming
+import Pyro.nsc
+import Pyro.util
+
+class PyroEventServer(Thread):
+ """Thread running the Pyro Event server.
+ """
+
+ def __init__(self,args=[]):
+ """Initialize pyro event server with command line arguments.
+ For a complete list of command line arguments, see pyro documentation
+ for pyro-es start script."""
+ Thread.__init__( self )
+ self.setDaemon( True )
+ self.setName( 'smartcard.pyro.server.PyroEventServer' )
+ self.args = args
+ self.handler = signal.signal( signal.SIGINT, self )
+ self.starter = None
+
+ def run(self):
+ """Starts Pyro naming server with command line arguments (see pyro documentation)
+ """
+ args=[]
+ for arg in self.args: args.append(arg)
+ Args = Pyro.util.ArgParser()
+ Args.parse(args,'hkmrvxn:p:b:c:d:s:i:1:2:')
+
+ hostname = Args.getOpt('n',None)
+ identification = Args.getOpt('i',None)
+ port = None
+ useNameServer = True
+
+ if port:
+ port=int(port)
+ norange = (port==0)
+
+ self.starter = Pyro.EventService.Server.EventServiceStarter(identification=identification)
+ self.starter.start(hostname,port,useNameServer=useNameServer,norange=norange)
+
+ def stop(self):
+ """Shutdown pyro event server."""
+ pass
+
+ def waitStarted(self):
+ """wait until name server is started."""
+ started = False
+ while not started:
+ if self.starter!=None:
+ started = self.starter.waitUntilStarted(0.5)
+
+ def __call__(self, signame, sf):
+ """Ctrl+c handler that will gracefully shutdown the server
+ upon Ctrl+C signal"""
+ print 'PyroEventServer Ctrl+C handler'
+ self.stop()
+ time.sleep(1)
+ self.handler( signame, sf )
+
+
+if __name__ == '__main__':
+ import sys
+ from smartcard.pyro.server.PyroNameServer import PyroNameServer
+ pn = PyroNameServer(sys.argv[1:])
+ pn.start()
+ pn.waitStarted()
+ pe = PyroEventServer(sys.argv[1:])
+ pe.start()
+ pe.waitStarted()
+ pn.listall()
+ pe.stop()
+ pn.stop()
+
+
Added: trunk/pyscard/src/smartcard/pyro/server/PyroNameServer.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/server/PyroNameServer.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/server/PyroNameServer.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1,118 @@
+"""Utility class to start/stop Pyro Name Server.
+
+__author__ = "http://www.gemalto.com"
+
+Copyright 2001-2010 gemalto
+Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+pyscard is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+
+import signal
+import sys
+from threading import Thread
+import time
+
+import Pyro.naming
+import Pyro.nsc
+import Pyro.util
+
+class PyroNameServer(Thread):
+ """Thread running the Pyro Name server.
+ """
+
+ def __init__(self,args=[]):
+ """Initialize pyro name server with command line arguments.
+ For a complete list of command line arguments, see pyro documentation
+ for pyro-ns start script."""
+ Thread.__init__( self )
+ self.setDaemon( True )
+ self.setName( 'smartcard.pyro.server.PyroNameServer' )
+ self.args = args
+ self.handler = signal.signal( signal.SIGINT, self )
+
+ _args=[]
+ for arg in self.args: _args.append(arg)
+ Args = Pyro.util.ArgParser()
+ Args.parse(_args,'hkmrvxn:p:b:c:d:s:i:1:2:')
+ self.host = Args.getOpt('n',None)
+ self.bcport = Args.getOpt('b',None)
+ self.bcaddr = Args.getOpt('c',None)
+ self.identification = Args.getOpt('i',None)
+
+ def getShutdownArgs(self):
+ """return command line arguments for shutting down the
+ server; this command line is built from the name server
+ startup arguments."""
+ shutdownArgs = []
+ if self.host: shutdownArgs += [ '-h', self.host ]
+ if self.bcport: shutdownArgs += [ '-p', self.bcport ]
+ if self.bcaddr: shutdownArgs += [ '-c', self.bcaddr ]
+ if self.identification: shutdownArgs += [ '-i', self.identification ]
+
+ return shutdownArgs
+
+ def listall(self):
+ """List pyro namespace."""
+ args = self.getShutdownArgs() + ['listall']
+ Pyro.nsc.main( args )
+
+ def ping(self):
+ """Ping pyro naming server."""
+ args = self.getShutdownArgs() + ['ping']
+ Pyro.nsc.main( args )
+
+ def run(self):
+ """Starts Pyro naming server with command line arguments (see pyro documentation)
+ """
+ args=[]
+ for arg in self.args: args.append(arg)
+ Pyro.naming.main( args )
+
+ def stop(self):
+ """Shutdown pyro naming server."""
+ args = self.getShutdownArgs() + ['shutdown']
+ Pyro.nsc.main( args )
+ self.join()
+
+ def waitStarted(self):
+ """wait until name server is started."""
+ ns = None
+ while not ns:
+ try:
+ time.sleep(3)
+ ns=Pyro.naming.NameServerLocator(identification=self.identification).getNS()
+ except Pyro.errors.NamingError as er:
+ pass
+
+ def __call__(self, signame, sf):
+ """Ctrl+c handler that will gracefully shutdown the server
+ upon Ctrl+C signal"""
+ print 'PyroNameServer Ctrl+C handler'
+ self.stop()
+ time.sleep(1)
+ self.handler( signame, sf )
+
+
+if __name__ == '__main__':
+ import sys
+ pt = PyroNameServer( sys.argv[1:] )
+ pt.start()
+ pt.waitStarted()
+ pt.stop()
+
+
Added: trunk/pyscard/src/smartcard/pyro/server/RemoteCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/server/RemoteCardConnection.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/server/RemoteCardConnection.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1,44 @@
+"""RemoteCardConnection class manages connections to a remote reader
+thru pyro (http://www.xs4all.nl/~irmen/pyro3/).
+
+__author__ = "http://www.gemalto.com"
+
+Copyright 2001-2010 gemalto
+Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+pyscard is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+
+import Pyro.core
+import Pyro.naming
+
+from smartcard.CardConnection import CardConnection
+from smartcard.CardConnectionDecorator import CardConnectionDecorator
+from smartcard.Exceptions import CardConnectionException, NoCardException
+from smartcard.Observer import Observable
+
+class RemoteCardConnection(CardConnectionDecorator,Pyro.core.ObjBase):
+ """Remote connection class. Handles connection with a card inserted inside a remote PC."""
+
+ def __init__(self, cardConnectionComponent):
+ """Construct a new remote card connection.
+
+ connection: the reader connection
+ """
+ Pyro.core.ObjBase.__init__(self)
+ CardConnectionDecorator.__init__( self, cardConnectionComponent )
+
Added: trunk/pyscard/src/smartcard/pyro/server/RemoteReaderServer.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/server/RemoteReaderServer.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/server/RemoteReaderServer.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1,121 @@
+"""RemoteReaderServer: monitor local readers and publish them as pyro
+Remote Readers.
+
+__author__ = "gemalto http://www.gemalto.com"
+
+Copyright 2001-2010 gemalto
+Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+pyscard is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+
+try:
+ import Pyro.core
+ import Pyro.naming
+except:
+ print 'You need pyro (python remote objects) at http://www.xs4all.nl/~irmen/pyro3/'
+ import sys
+ sys.exit()
+
+import signal
+import time
+
+import smartcard.System
+from smartcard.reader.Reader import Reader
+from smartcard.ReaderMonitoring import ReaderMonitor, ReaderObserver
+from smartcard.pyro.server.RemoteCardConnection import RemoteCardConnection
+from smartcard.pyro.server import PyroDaemon
+from smartcard.pyro.server import PyroNameServer
+
+class RemoteReader(Reader,Pyro.core.ObjBase):
+ """Remote reader class that embeds a local reader."""
+
+ def __init__(self,reader):
+ """Encapsulate a local reader and publish as a pyro remote reader.
+
+ reader: the local reader to publish remotely
+ """
+ Pyro.core.ObjBase.__init__(self)
+ self.readerobj = reader
+ self.name = reader.name
+
+ def addtoreadergroup( self, groupname ):
+ """Add reader to a reader group."""
+ self.readerobj.reader.addtoreadergroup( groupname )
+
+ def removefromreadergroup( self, groupname ):
+ """Remove a reader from a reader group"""
+ self.readerobj.reader.removefromreadergroup( groupname )
+
+ def createConnection( self ):
+ """Return a card connection thru the reader."""
+ connection = RemoteCardConnection( self.readerobj.createConnection() )
+ daemon = PyroDaemon.PyroDaemon()
+ uri = daemon.connect(connection)
+ return uri
+
+
+
+class RemoteReaderServer(ReaderObserver):
+ """Monitor local readers, and publish them as remote pyro readers.
+ """
+ def __init__(self):
+ """Starts pyro name server and constructs reader name space."""
+ self.pn = PyroNameServer.PyroNameServer()
+ self.pn.start()
+ self.pn.waitStarted()
+
+ Pyro.core.initServer()
+ self.ns=Pyro.naming.NameServerLocator().getNS()
+ try:
+ self.ns.createGroup(':pyscard')
+ self.ns.createGroup(':pyscard.smartcard')
+ self.ns.createGroup(':pyscard.smartcard.readers')
+ except Pyro.errors.NamingError as error:
+ print error
+ self.daemon = PyroDaemon.PyroDaemon()
+ self.remotereaders = {}
+
+ def start(self):
+ """Start pyro daemon and accept incoming requests."""
+ self.daemon.start()
+
+
+ def update(self, observable, (addedreaders, removedreaders)):
+ """Called when a local reader is added or removed.
+ Create remote pyro reader objects for added readers.
+ Delete remote pyro reader objects for removed readers."""
+ for reader in addedreaders:
+ remotereader = RemoteReader(reader)
+ self.remotereaders[reader.name] = remotereader
+ name = "".join(reader.name.split(' '))
+ name = ":pyscard.smartcard.readers."+"".join(name.split('.'))
+ uri = self.daemon.connect(remotereader,name)
+ for reader in removedreaders:
+ remotereader = self.remotereaders[reader.name]
+ self.daemon.disconnect(remotereader)
+ del self.remotereaders[reader.name]
+ self.pn.listall()
+
+
+if __name__ == '__main__':
+ readerserver = RemoteReaderServer()
+ readermonitor = ReaderMonitor()
+ readermonitor.addObserver(readerserver)
+ print 'Reader remote server up and running',
+ print 'Please enter Ctrl+C to stop and exit...'
+ readerserver.start()
Added: trunk/pyscard/src/smartcard/pyro/server/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/pyro/server/__init__.py (rev 0)
+++ trunk/pyscard/src/smartcard/pyro/server/__init__.py 2010-08-18 13:40:51 UTC (rev 509)
@@ -0,0 +1 @@
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2011-09-03 21:28:28
|
Revision: 541
http://pyscard.svn.sourceforge.net/pyscard/?rev=541&view=rev
Author: ludov
Date: 2011-09-03 21:28:22 +0000 (Sat, 03 Sep 2011)
Log Message:
-----------
Add CardConnection.getAttrib() method
Sample code:
card_connection = readers()[0].createConnection()
card_connection.connect(mode=SCARD_SHARE_DIRECT, disposition=SCARD_LEAVE_CARD)
vendor_name = card_connection.getAttrib(SCARD_ATTR_VENDOR_NAME)
Modified Paths:
--------------
trunk/pyscard/src/smartcard/CardConnection.py
trunk/pyscard/src/smartcard/CardConnectionDecorator.py
trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
Modified: trunk/pyscard/src/smartcard/CardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnection.py 2011-09-03 16:44:37 UTC (rev 540)
+++ trunk/pyscard/src/smartcard/CardConnection.py 2011-09-03 21:28:22 UTC (rev 541)
@@ -174,3 +174,21 @@
Subclasses must override this method for implementing control."""
pass
+
+ def getAttrib(self, attribId):
+ """return the requested attribute
+
+ attribId: attribute id like SCARD_ATTR_VENDOR_NAME
+ """
+ Observable.setChanged(self)
+ Observable.notifyObservers(self, CardConnectionEvent('attrib', [attribId]))
+ data = self.doGetAttrib(attribId)
+ if None != self.errorcheckingchain:
+ self.errorcheckingchain[0](data)
+ return data
+
+ def doGetAttrib(self, attribId):
+ """Performs the command get attrib.
+
+ Subclasses must override this method for implementing get attrib."""
+ pass
Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py
===================================================================
--- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2011-09-03 16:44:37 UTC (rev 540)
+++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2011-09-03 21:28:22 UTC (rev 541)
@@ -84,3 +84,7 @@
def control(self, controlCode, bytes=[]):
"""call inner component control"""
return self.component.control(controlCode, bytes)
+
+ def getAttrib(self, attribId):
+ """call inner component getAttrib"""
+ return self.component.getAttrib(attribId)
Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py
===================================================================
--- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2011-09-03 16:44:37 UTC (rev 540)
+++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2011-09-03 21:28:22 UTC (rev 541)
@@ -197,6 +197,20 @@
data = map(lambda x: (x + 256) % 256, response)
return data
+ def doGetAttrib(self, attribId):
+ """get an attribute
+
+ attribId: Identifier for the attribute to get
+
+ return: response are the attribute byte array
+ """
+ CardConnection.doGetAttrib(self, attribId)
+ hresult, response = SCardGetAttrib(self.hcard, attribId)
+ if hresult != 0:
+ raise CardConnectionException('Failed to getAttrib ' + SCardGetErrorMessage(hresult))
+ return response
+
+
if __name__ == '__main__':
"""Small sample illustrating the use of CardConnection."""
SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|