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);
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):
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();