X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETMCPCANCommunication.py;h=decd092d79dc5f892bb63cd1739f5a052b3c4407;hp=b09fb5e84b8c30de55a20426c5b438addba416c3;hb=aaa8df93b42a926aab0cede6f70835089663fafc;hpb=f3f96e7ef9e9fd6fe27360651e3c2142ac1eae8c diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index b09fb5e..decd092 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -72,7 +72,7 @@ class GoodFETMCPCANCommunication: # SNIFF ########################## - def sniff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug=False, faster=False): + def sniff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug=False, faster=False, parsed=True): #reset eveything on the chip self.client.serInit() @@ -174,7 +174,23 @@ class GoodFETMCPCANCommunication: row.append("%f"%time.time()); if( verbose==True): - print self.client.packet2str(packet) + #if we want to print a parsed message + if( parsed == True): + sId = packet['sID'] + msg = "sID: %d" %sID + if( packet.get('eID')): + msg += " eID: %d" %packet.get('eID') + msg += " rtr: %d"%packet['rtr'] + length = packet['length'] + msg += " length: %d"%length + msg += "data:" + for i in range(0,length): + dbidx = 'db%d'%i + msg +=" %d"% packet[dbidx] + print msg + # if we want to print just the message as it is read off the chip + else: + print self.client.packet2str(packet) if(debug == True):