renamed ccid reader select file python script

The command can be called now using the following command:
./simtrace -S
diff --git a/usb_application/ccid_reader_general.py b/usb_application/ccid_reader_general.py
deleted file mode 100755
index 39cf423..0000000
--- a/usb_application/ccid_reader_general.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-from smartcard.scard import *
-import smartcard.util
-
-SELECT = [0x00, 0xA4, 0x04, 0x00, 0x0A, 0xA0, 0x00, 0x00, 0x00, 0x62,
-    0x03, 0x01, 0x0C, 0x06, 0x01]
-COMMAND = [0x00, 0x00, 0x00, 0x00]
-
-try:
-    hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
-    if hresult != SCARD_S_SUCCESS:
-        raise Exception('Failed to establish context : ' +
-            SCardGetErrorMessage(hresult))
-    print 'Context established!'
-
-    try:
-        hresult, readers = SCardListReaders(hcontext, [])
-        if hresult != SCARD_S_SUCCESS:
-            raise Exception('Failed to list readers: ' +
-                SCardGetErrorMessage(hresult))
-        print 'PCSC Readers:', readers
-
-        if len(readers) < 1:
-            raise Exception('No smart card readers')
-
-        reader = readers[0]
-        print "Using reader:", reader
-        
-        try:
-            hresult, hcard, dwActiveProtocol = SCardConnect(hcontext, reader,
-                SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1)
-            if hresult != SCARD_S_SUCCESS:
-                raise Exception('Unable to connect: ' +
-                    SCardGetErrorMessage(hresult))
-            print 'Connected with active protocol', dwActiveProtocol
-
-            try:
-                hresult, response = SCardTransmit(hcard, dwActiveProtocol,
-                    SELECT)
-                if hresult != SCARD_S_SUCCESS:
-                    raise Exception('Failed to transmit: ' +
-                        SCardGetErrorMessage(hresult))
-                print 'Select: ' + smartcard.util.toHexString(response,
-                    smartcard.util.HEX)
-                hresult, response = SCardTransmit(hcard, dwActiveProtocol,
-                    COMMAND)
-                if hresult != SCARD_S_SUCCESS:
-                    raise Exception('Failed to transmit: ' +
-                        SCardGetErrorMessage(hresult))
-                print 'Command: ' + smartcard.util.toHexString(response,
-                    smartcard.util.HEX)
-            finally:
-                hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD)
-                if hresult != SCARD_S_SUCCESS:
-                    raise Exception('Failed to disconnect: ' +
-                        SCardGetErrorMessage(hresult))
-                print 'Disconnected'
-
-
-        except Exception, message:
-            print "Exception:", message
-
-    finally:
-        hresult = SCardReleaseContext(hcontext)
-        if hresult != SCARD_S_SUCCESS:
-            raise Exception('Failed to release context: ' +
-                    SCardGetErrorMessage(hresult))
-        print 'Released context.'
-
-except Exception, message:
-    print "Exception:", message
diff --git a/usb_application/ccid_select.py b/usb_application/ccid_select.py
new file mode 100755
index 0000000..5889a60
--- /dev/null
+++ b/usb_application/ccid_select.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+from smartcard.scard import *
+import smartcard.util
+
+SELECT = [0x00, 0xA4, 0x04, 0x00, 0x0A, 0xA0, 0x00, 0x00, 0x00, 0x62,
+    0x03, 0x01, 0x0C, 0x06, 0x01]
+COMMAND = [0x00, 0x00, 0x00, 0x00]
+
+def select():
+    try:
+        hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
+        if hresult != SCARD_S_SUCCESS:
+            raise Exception('Failed to establish context : ' +
+                SCardGetErrorMessage(hresult))
+        print 'Context established!'
+
+        try:
+            hresult, readers = SCardListReaders(hcontext, [])
+            if hresult != SCARD_S_SUCCESS:
+                raise Exception('Failed to list readers: ' +
+                    SCardGetErrorMessage(hresult))
+            print 'PCSC Readers:', readers
+
+            if len(readers) < 1:
+                raise Exception('No smart card readers')
+
+            reader = readers[0]
+            print "Using reader:", reader
+            
+            try:
+                hresult, hcard, dwActiveProtocol = SCardConnect(hcontext, reader,
+                    SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1)
+                if hresult != SCARD_S_SUCCESS:
+                    raise Exception('Unable to connect: ' +
+                        SCardGetErrorMessage(hresult))
+                print 'Connected with active protocol', dwActiveProtocol
+
+                try:
+                    hresult, response = SCardTransmit(hcard, dwActiveProtocol,
+                        SELECT)
+                    if hresult != SCARD_S_SUCCESS:
+                        raise Exception('Failed to transmit: ' +
+                            SCardGetErrorMessage(hresult))
+                    print 'Select: ' + smartcard.util.toHexString(response,
+                        smartcard.util.HEX)
+                    hresult, response = SCardTransmit(hcard, dwActiveProtocol,
+                        COMMAND)
+                    if hresult != SCARD_S_SUCCESS:
+                        raise Exception('Failed to transmit: ' +
+                            SCardGetErrorMessage(hresult))
+                    print 'Command: ' + smartcard.util.toHexString(response,
+                        smartcard.util.HEX)
+                finally:
+                    hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD)
+                    if hresult != SCARD_S_SUCCESS:
+                        raise Exception('Failed to disconnect: ' +
+                            SCardGetErrorMessage(hresult))
+                    print 'Disconnected'
+
+
+            except Exception, message:
+                print "Exception:", message
+
+        finally:
+            hresult = SCardReleaseContext(hcontext)
+            if hresult != SCARD_S_SUCCESS:
+                raise Exception('Failed to release context: ' +
+                        SCardGetErrorMessage(hresult))
+            print 'Released context.'
+
+    except Exception, message:
+        print "Exception:", message
diff --git a/usb_application/simtrace.py b/usb_application/simtrace.py
index 8c4993a..1055a3d 100755
--- a/usb_application/simtrace.py
+++ b/usb_application/simtrace.py
@@ -3,6 +3,7 @@
 import argparse
 import sniffer
 import ccid
+import ccid_select
 
 import usb.core
 import usb.util
@@ -48,6 +49,7 @@
     parser.add_argument("-c", "--cmd", help="cmds to send to sim card (Not supported yet)", 
         choices=["cmd1", "cmd2", "cmd_poweron", "cmd_poweroff", "cmd_get_slot_stat", "cmd_get_param"])
     parser.add_argument("-s", "--sniff", help="Sniff communication!", action='store_true') 
+    parser.add_argument("-S", "--select_file", help="Transmit SELECT cmd!", action='store_true')
     
     args = parser.parse_args()
     print("args: ", args)
@@ -57,6 +59,7 @@
         devs = usb.core.find(find_all=1, custom_match=find_class(0xb))  # 0xb = Smartcard
         for dev in devs:
             dev.set_configuration(args.conf)
+#            ret = dev.read(0x83, 64, 100)
 
     if args.read_bin is True: 
         ccid.pySim_read() 
@@ -66,9 +69,13 @@
         for dev in devs:
             dev.write(0x1, args.cmd)
             ret = dev.read(0x82, 64)
+#            ret = dev.read(0x83, 64, 100)
             print(ret)
     if args.sniff is True:
         sniffer.sniff()
+    if args.select_file is True:
+        ccid_select.select()
+
     return
 
 #    (epi, epo) = find_eps(dev)