From: <jda...@us...> - 2012-04-08 09:38:16
|
Revision: 593 http://pyscard.svn.sourceforge.net/pyscard/?rev=593&view=rev Author: jdaussel Date: 2012-04-08 09:38:10 +0000 (Sun, 08 Apr 2012) Log Message: ----------- Updated sample to reflect OS cards Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2012-04-08 09:31:18 UTC (rev 592) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2012-04-08 09:38:10 UTC (rev 593) @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +import platform from smartcard.scard import * import smartcard.guid @@ -52,14 +53,20 @@ try: # list interfaces for a known card + if -1 != platform.platform().find('Windows-7'): + expectedCard = 'Identity Device (Microsoft Generic Profile)' + elif -1 != platform.platform().find('Windows-Vista-6.0'): + expectedCard = 'Axalto Cryptoflex .NET' + else: + expectedCard = 'Schlumberger Cryptoflex 8k v2' hresult, interfaces = SCardListInterfaces( hcontext, - 'Schlumberger Cryptoflex 8k v2') + expectedCard) if hresult != SCARD_S_SUCCESS: raise scard.error( 'Failed to list interfaces: ' + \ SCardGetErrorMessage(hresult)) - print 'Interfaces for Schlumberger Cryptoflex 8k v2:', interfaces + print 'Interfaces for ', expectedCard, ':', interfaces # introduce a card (forget first in case it is already present) hresult = SCardForgetCardType(hcontext, znewcardName) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |