X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=d7875bc6e2a68f695eb238fee8dedd00092b1eea;hp=468b0915dd22020bd77971327000269005d6b6fb;hb=a3dbd267c9f9a20853ccbf64011ce3e185182106;hpb=dbcedaa279472080a2585e959a3146f3c5859556 diff --git a/client/GoodFET.py b/client/GoodFET.py index 468b091..d7875bc 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -8,6 +8,8 @@ import sys, time, string, cStringIO, struct, glob, serial, os; import sqlite3; +fmt = ("B", ">16)&0xFF]); print "Got %02x%02x buffer size." % (self.data[1],self.data[0]); @@ -158,10 +166,12 @@ class GoodFET: print "Rx: ( 0x%02x, 0x%02x, 0x%04x )" % ( self.app, self.verb, self.count ) #Debugging string; print, but wait. - if self.app==0xFF and self.verb==0xFF: - print "# DEBUG %s" % self.serialport.read(self.count); + if self.app==0xFF: + if self.verb==0xFF: + print "# DEBUG %s" % self.serialport.read(self.count) + elif self.verb==0xFE: + print "# DEBUG 0x%x" % struct.unpack(fmt[self.count-1], self.serialport.read(self.count))[0] sys.stdout.flush(); - return [] else: self.data=self.serialport.read(self.count); return self.data; @@ -213,7 +223,9 @@ class GoodFET: self.besilent=s; print "besilent is %i" % self.besilent; self.writecmd(0,0xB0,1,[s]); - + def mon_connected(self): + """Announce to the monitor that the connection is good.""" + self.writecmd(0,0xB1,0,[]); def out(self,byte): """Write a byte to P5OUT.""" self.writecmd(0,0xA1,1,[byte]);