X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=5a0f78ba70f690fcbdcb67b2fb77813efb18b2dc;hp=ec1c47034498062aa6e453964e70970e9c23d7b0;hb=1536c622c446a0928fb2e9e44cdc67e7cceb6e7e;hpb=f217c730250832ae74a60b9d494111eac3763fd6 diff --git a/client/GoodFET.py b/client/GoodFET.py index ec1c470..5a0f78b 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -69,7 +69,7 @@ class GoodFET: return self.symbols.get(name); def timeout(self): print "timeout\n"; - def serInit(self, port=None, timeout=0.5): + def serInit(self, port=None, timeout=2): """Open the serial port""" # Make timeout None to wait forever, 0 for non-blocking mode. @@ -77,6 +77,8 @@ class GoodFET: glob_list = glob.glob(os.environ.get("GOODFET")); if len(glob_list) > 0: port = glob_list[0]; + else: + port = os.environ.get("GOODFET"); if port is None: glob_list = glob.glob("/dev/tty.usbserial*"); if len(glob_list) > 0: @@ -86,6 +88,7 @@ class GoodFET: if len(glob_list) > 0: port = glob_list[0]; + self.serialport = serial.Serial( port, #9600, @@ -312,12 +315,13 @@ class GoodFET: """Self-test several functions through the monitor.""" print "Performing monitor self-test."; - if self.peekword(0x0c00)!=0x0c04 and self.peekword(0x0c00)!=0x0c06: - print "ERROR Fetched wrong value from 0x0c04."; - self.pokebyte(0x0021,0); #Drop LED - if self.peekbyte(0x0021)!=0: - print "ERROR, P1OUT not cleared."; - self.pokebyte(0x0021,1); #Light LED + for f in range(0,30): + if self.peekword(0x0c00)!=0x0c04 and self.peekword(0x0c00)!=0x0c06: + print "ERROR Fetched wrong value from 0x0c04."; + self.pokebyte(0x0021,0); #Drop LED + if self.peekbyte(0x0021)!=0: + print "ERROR, P1OUT not cleared."; + self.pokebyte(0x0021,1); #Light LED print "Self-test complete.";