Bluetooth support.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Mon, 29 Aug 2011 00:27:21 +0000 (00:27 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Mon, 29 Aug 2011 00:27:21 +0000 (00:27 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1038 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFET.py
client/goodfet.monitor

index ab6bb09..4e42bc5 100755 (executable)
@@ -72,12 +72,15 @@ class GoodFETbtser:
         sock.connect((btaddr,port));
         sock.settimeout(10);  #IMPORTANT Must be patient.
         
-        #Once connected, we need to get synced.
-        #This might require a firmware patch.
-        str=None;
-        while str!="http://goodfet.sf.net/":
-            str=self.read(64);
-            print str;
+        ##This is what we'd do for a normal reset.
+        #str="";
+        #while not str.endswith("goodfet.sf.net/"):
+        #    str=self.read(64);
+        #    print str;
+        
+        # Instead, just return and hope for the best.
+        return;
+        
     def write(self,msg):
         """Send traffic."""
         return self.sock.send(msg);
@@ -109,14 +112,17 @@ class GoodFET:
         print "timeout\n";
     def serInit(self, port=None, timeout=2, attemptlimit=None):
         """Open a serial port of some kind."""
+        import re;
         
-        if port=="bluetooth" or os.environ.get("GOODFET")=="bluetooth":
+        if port==None:
+            port=os.environ.get("GOODFET");
+        if port=="bluetooth" or (port is not None and re.match("..:..:..:..:..:..",port)):
             self.btInit(port,timeout,attemptlimit);
         else:
             self.pyserInit(port,timeout,attemptlimit);
     def btInit(self, port, timeout, attemptlimit):
         """Open a bluetooth port.""";
-        self.verbose=True;
+        #self.verbose=True;  #For debugging BT.
         self.serialport=GoodFETbtser(port);
         
     def pyserInit(self, port, timeout, attemptlimit):
index 8e90c59..d11b422 100755 (executable)
@@ -48,6 +48,10 @@ if(sys.argv[1]=="exec"):
     
 if(sys.argv[1]=="info"):
     client.monitor_info()
+if(sys.argv[1]=="infotest"):
+    for foo in range(0,100):
+        client.monitor_info()
+
 if(sys.argv[1]=="clocktest"):
     print "GoodFET with %s MCU" % client.infostring();
     clocking=client.monitorgetclock();