myriad of arm/adi additions. working on moving past arm7 into adiv5
[goodfet] / client / goodfet
index ed3b9e8..c8e2187 100755 (executable)
@@ -5,22 +5,48 @@
 #
 # This code is being rewritten and refactored.  You've been warned!
 
-import sys, os, readline, code, binascii;
-import rlcompleter;
+import sys, os, code, binascii;
+#import rlcompleter, readline;
 
 from GoodFET import GoodFET, getClient;
 from GoodFETConsole import GoodFETConsole;
-#from GoodFET import *;
 
 from intelhex import IntelHex;
 
 if(len(sys.argv)==1):
-    print "Usage: %s driver\n" % sys.argv[0];
-    print "driver:= GoodFETCC GoodFETMSP430";
-    print;
+    print "Usage: %s [driver|verb]\n" % sys.argv[0];
+    print "driver:= monitor | cc | avr | spi | msp430 | nrf";
+    print "verb:=   scan";
+    print "";
     print "This is an unfinished client.  You probably want goodfet.$chip instead.";
     sys.exit(1);
 
+verb=sys.argv[1];
+if verb=="scan":
+    from scanwin32 import *;
+    # INIT COMPORT SCAN
+    scan=winScan();
+    #scan.comports();
+    
+    for order, port, desc, hwid in sorted(scan.comports()):
+        # Look for FTDIBUS
+        try:
+            #hwid.index('FTDI')
+            #print "*************"
+            #print "GOODFET FOUND"
+            #print "*************"
+            if hwid.index('FTDI')!=0: continue;
+            print "%s: (%s)" % (port, hwid),
+            try:
+                serial.Serial(port)
+            except serial.serialutil.SerialException:
+                print "Busy"
+            else:
+                print "Ready"
+        except:
+            pass
+    sys.exit(0);
+
 driver=sys.argv[1];
 print "Using driver %s" % driver;
 #client=eval("%s()" % driver);