X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=client%2FGoodFET.py;h=b9c35e3adc4bad1f12b53103f85d30cadc12aba7;hb=986a2cbf10bdbe19688b9eb1b365ac3b328919ed;hp=1ef6171e5770a1c3fe2b39d5672702c5c17cd5b8;hpb=f7602f756c1fec1877b667296bae7c2a19e9cdb0;p=goodfet diff --git a/client/GoodFET.py b/client/GoodFET.py index 1ef6171..b9c35e3 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -11,12 +11,13 @@ import sqlite3; fmt = ("B", " 0: port = glob_list[0]; - + if os.name=='nt': + from scanwin32 import winScan; + scan=winScan(); + for order,comport,desc,hwid in sorted(scan.comports()): + if hwid.index('FTDI')==0: + port=comport; + #print "Using FTDI port %s" % port + self.serialport = serial.Serial( port, @@ -103,6 +111,7 @@ class GoodFET: connected=0; while connected==0: while self.verb!=0x7F or self.data!="http://goodfet.sf.net/": + #print "Resyncing."; self.serialport.flushInput() self.serialport.flushOutput() #Explicitly set RTS and DTR to halt board. @@ -112,16 +121,17 @@ class GoodFET: self.serialport.setDTR(0); self.serialport.flushInput() self.serialport.flushOutput() - #time.sleep(.1); + #time.sleep(60); attempts=attempts+1; self.readcmd(); #Read the first command. #Here we have a connection, but maybe not a good one. connected=1; olds=self.infostring(); - self.monitorclocking(); + clocking=self.monitorclocking(); for foo in range(1,30): if not self.monitorecho(): - print "Comm error, resyncing."; + if self.verbose: print "Comm error on %i try, resyncing out of %s." % (foo, + clocking); connected=0; break; if self.verbose: print "Connected after %02i attempts." % attempts; @@ -267,6 +277,9 @@ class GoodFET: def peekword(self,address): """Read a word of memory from the monitor.""" return self.peekbyte(address)+(self.peekbyte(address+1)<<8); + def peek(self,address): + """Read a word of memory from the monitor.""" + return self.peekbyte(address)+(self.peekbyte(address+1)<<8); def pokebyte(self,address,value): """Set a byte of memory by the monitor.""" self.data=[address&0xff,address>>8,value]; @@ -347,7 +360,7 @@ class GoodFET: data="The quick brown fox jumped over the lazy dog."; self.writecmd(self.MONITORAPP,0x81,len(data),data); if self.data!=data: - if verbose: print "Comm error recognized."; + if self.verbose: print "Comm error recognized by monitorecho()."; return 0; return 1; def monitorclocking(self): @@ -391,7 +404,6 @@ class GoodFET: def dump(self,file,start=0,stop=0xffff): """Dump an intel hex file from code memory.""" print "Dump not implemented."; - def peek32(self,address, memory="vn"): return (self.peek16(address,memory)+ (self.peek16(address+2,memory)<<16)); @@ -400,5 +412,8 @@ class GoodFET: (self.peek8(address+1,memory)<<8)); def peek8(self,address, memory="vn"): return self.peekbyte(address); #monitor + def peekword(self,address, memory="vn"): + return self.peek(address); #monitor + def loadsymbols(self): return;