[Pcsclite-cvs-commit] r6001 - /trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Wed Oct 5 12:09:00 UTC 2011


Author: rousseau
Date: Wed Oct  5 12:08:59 2011
New Revision: 6001

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6001
Log:
Unitary test for FEATURE_CCID_ESC_COMMAND

Added:
    trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py   (with props)

Added: trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py?rev=6001&op=file
==============================================================================
--- trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py (added)
+++ trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py Wed Oct  5 12:08:59 2011
@@ -1,0 +1,50 @@
+#! /usr/bin/env python
+
+"""
+#   FEATURE_CCID_ESC_COMMAND.py: Unitary test for FEATURE_CCID_ESC_COMMAND
+#   Copyright (C) 2011  Ludovic Rousseau
+"""
+
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program 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 General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, see <http://www.gnu.org/licenses/>.
+
+from smartcard.System import readers
+from smartcard.pcsc.PCSCPart10 import (SCARD_SHARE_DIRECT,
+    SCARD_LEAVE_CARD, FEATURE_CCID_ESC_COMMAND, getFeatureRequest, hasFeature)
+
+
+def main():
+    """ main """
+    card_connection = readers()[0].createConnection()
+    card_connection.connect(mode=SCARD_SHARE_DIRECT,
+        disposition=SCARD_LEAVE_CARD)
+
+    feature_list = getFeatureRequest(card_connection)
+
+    ccid_esc_command = hasFeature(feature_list, FEATURE_CCID_ESC_COMMAND)
+    if ccid_esc_command is None:
+        raise Exception("The reader does not support FEATURE_CCID_ESC_COMMAND")
+
+    # proprietary commands for Xiring readers
+    version = [ord(c) for c in "VERSION"]
+    res = card_connection.control(ccid_esc_command, version)
+    print res
+    print ''.join([chr(x) for x in res])
+
+    serial = [ord(c) for c in "GET_SN"]
+    res = card_connection.control(ccid_esc_command, serial)
+    print res
+    print ''.join([chr(x) for x in res])
+
+if __name__ == "__main__":
+    main()

Propchange: trunk/PCSC/UnitaryTests/FEATURE_CCID_ESC_COMMAND.py
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pcsclite-cvs-commit mailing list