Beginnings of smartcard client.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 19 Feb 2010 22:01:31 +0000 (22:01 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 19 Feb 2010 22:01:31 +0000 (22:01 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@335 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFETAVR.py
client/GoodFETSmartCard.py [new file with mode: 0755]
client/goodfet.cc
client/goodfet.sc [new file with mode: 0755]

index c0af361..f480017 100644 (file)
@@ -55,7 +55,7 @@ class GoodFETAVR(GoodFET):
         };
     
     def setup(self):
-        """Move the FET into the SPI application."""
+        """Move the FET into the AVR application."""
         self.writecmd(self.AVRAPP,0x10,0,self.data); #SPI/SETUP
     
     def trans(self,data):
diff --git a/client/GoodFETSmartCard.py b/client/GoodFETSmartCard.py
new file mode 100755 (executable)
index 0000000..135ad0d
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# GoodFET SPI and SPIFlash Client Library
+# 
+# (C) 2009 Travis Goodspeed <travis at radiantmachines.com>
+#
+# This code is being rewritten and refactored.  You've been warned!
+
+import sys, time, string, cStringIO, struct, glob, serial, os;
+
+from GoodFET import GoodFET;
+
+class GoodFETSmartCard(GoodFET):
+    SMARTCARDAPP=0x73;
+    APP=SMARTCARDAPP;
+    
+    def setup(self):
+        """Move the FET into the SmartCard application."""
+        self.writecmd(self.APP,0x10,0,self.data);
+    def start(self):
+        """Start the connection, reat ATR."""
+        self.writecmd(self.APP,0x20,0,None);
index 3c00dc7..6682650 100755 (executable)
@@ -90,6 +90,8 @@ if(sys.argv[1]=="dumpdata"):
     h.write_hex_file(f);
 if(sys.argv[1]=="status"):
     print "Status: %s" %client.CCstatusstr();
+if(sys.argv[1]=="info"):
+    print "%s" % client.CCidentstr();
 if(sys.argv[1]=="erase"):
     print "Status: %s" % client.CCstatusstr();
     client.CCchiperase();
diff --git a/client/goodfet.sc b/client/goodfet.sc
new file mode 100755 (executable)
index 0000000..115be85
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+import sys;
+import binascii;
+
+from GoodFETSmartCard import GoodFETSmartCard;
+from intelhex import IntelHex16bit, IntelHex;
+
+#Initialize FET and set baud rate
+client=GoodFETSmartCard();
+client.serInit()
+
+#Connect to target
+client.start();