X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETMCPCANCommunication.py;h=09519d279f358e6a92c408dff67872988ae0b736;hp=6aee2efd836b22b70f322b0e091a201d6e8fa78b;hb=a8b686459e73c8a37df4537083a675fc21de4699;hpb=3a68664f8b47dd3aff108a22d5156f8747a24ee5 diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index 6aee2ef..09519d2 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -173,10 +173,11 @@ class GoodFETMCPCANCommunication: print "Message in RXB0; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype elif(messagestat == 0x00): print "No messages in buffers." - + #check to see if there was a packet + if( packet != None): + packetcount+=1; if (packet!=None and writeToFile == True): - packetcount+=1; row = []; row.append("%f"%time.time()); @@ -237,8 +238,8 @@ class GoodFETMCPCANCommunication: for byte in packet: row.append("%02x"%ord(byte)); dataWriter.writerow(row); - - outfile.close() + if(writeToFile == True): + outfile.close() print "Listened for %d seconds, captured %d packets." %(duration,packetcount); return packetcount @@ -509,9 +510,9 @@ class GoodFETMCPCANCommunication: if period != None: for i in range(0,writes): self.client.MCPrts(TXB0=True); - tic = time.time() + #tic = time.time() time.sleep(period/1000) # pause for period ms before sending again - print time.time()-tic + #print time.time()-tic #starttime = time.time(); #while((time.time()-starttime < duration)): # self.client.MCPrts(TXB0=True);