X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETConsole.py;h=cf74cf9677dfa2644d99d6cb904c7d5f5c11546b;hp=72077e7ac9d65f8314eb679816271ac6e73d8672;hb=06c35c53c6ccc3eb8d3860f0a22ef3e559c293e0;hpb=6097d6dc581f9331d80c8f1a04d307dd68a2fd0d diff --git a/client/GoodFETConsole.py b/client/GoodFETConsole.py index 72077e7..cf74cf9 100644 --- a/client/GoodFETConsole.py +++ b/client/GoodFETConsole.py @@ -19,6 +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: + cmd=sys.stdin.readline(); + 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. @@ -66,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('~'));