X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETConsole.py;h=cf74cf9677dfa2644d99d6cb904c7d5f5c11546b;hp=cd0045f01cc59aa67386a58a752e28b06671d4ac;hb=06c35c53c6ccc3eb8d3860f0a22ef3e559c293e0;hpb=ad4619be9d5a713318196ead4aeb6000e7d3f0e3 diff --git a/client/GoodFETConsole.py b/client/GoodFETConsole.py index cd0045f..cf74cf9 100644 --- a/client/GoodFETConsole.py +++ b/client/GoodFETConsole.py @@ -19,13 +19,18 @@ class GoodFETConsole(): client.serInit(); client.setup(); client.start(); + def prompt(self): + sys.stdout.write("gf% "); + sys.stdout.flush(); def run(self): + self.prompt(); + #for cmd in sys.stdin: while 1: - sys.stdout.write("gf% "); - sys.stdout.flush(); cmd=sys.stdin.readline(); - self.handle(cmd); - + if not cmd: break; + if(cmd.strip()!=""): + self.handle(cmd); + self.prompt(); def handle(self, str): """Handle a command string. First word is command.""" #Lines beginning with # are comments. @@ -73,6 +78,14 @@ class GoodFETConsole(): def CMDflash(self,args): file=args[1]; self.client.flash(self.expandfilename(file)); + def CMDchip(self,args): + cmd="self.client.CMD%s()" % args[1]; + print cmd; + try: + eval(cmd); + except: + print sys.exc_info()[0]; + print "Chip-specific command failed."; def expandfilename(self,filename): if(filename[0]=='~'): return "%s%s" % (os.environ.get("HOME"),filename.lstrip('~'));