X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=d8e4ac51d9006d0bd6485f39cf628b9ba91c55a6;hp=ef218333005c155af87cb76312e79ffba3475219;hb=a031b4a563978102c664466d1e91a9c3ab0553dd;hpb=5ea4c9f824eed5226b9939b4f28fe1fda9c14dda diff --git a/client/GoodFET.py b/client/GoodFET.py index ef21833..d8e4ac5 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -90,6 +90,10 @@ class GoodFET: glob_list = glob.glob("/dev/ttyUSB*"); if len(glob_list) > 0: port = glob_list[0]; + if port is None: + glob_list = glob.glob("/dev/ttyU0"); + if len(glob_list) > 0: + port = glob_list[0]; if os.name=='nt': from scanwin32 import winScan; scan=winScan(); @@ -115,7 +119,8 @@ class GoodFET: connected=0; while connected==0: while self.verb!=0x7F or self.data!="http://goodfet.sf.net/": - #print "Resyncing."; + if attempts>2: + print "Resyncing."; self.serialport.flushInput() self.serialport.flushOutput() #Explicitly set RTS and DTR to halt board. @@ -126,6 +131,7 @@ class GoodFET: #TelosB reset, prefer software to I2C SPST Switch. if(os.environ.get("platform")=='telosb'): + #print "TelosB Reset"; self.telosBReset(); #self.serialport.write(chr(0x80)); #self.serialport.write(chr(0x80)); @@ -151,6 +157,8 @@ class GoodFET: if self.verbose: print "Connected after %02i attempts." % attempts; self.mon_connected(); self.serialport.setTimeout(12); + def serClose(self): + self.serialport.close(); def telosSetSCL(self, level): self.serialport.setRTS(not level) def telosSetSDA(self, level):