decode: updates all around

Rewrite packet handling so packets can span multiple USB URBs
(which sometimes happens with WMC) and also add a bunch more
WMC decoding stuff.
This commit is contained in:
Dan Williams
2012-01-21 12:55:16 -06:00
parent a9d6b5a8b6
commit c37fdf5f94
4 changed files with 235 additions and 132 deletions

View File

@@ -41,31 +41,17 @@ if __name__ == "__main__":
lines = f.readlines()
f.close()
in_packet = False
finish_packet = False
pkt_lines = []
packet = None
for l in lines:
if l[0] == '[':
# Start of a packet
if "] >>> URB" in l or "] <<< URB" in l:
if in_packet == True:
in_packet = False
finish_packet = True
else:
in_packet = True
elif "] UsbSnoop - " in l:
# Packet done?
if in_packet == True:
in_packet = False
finish_packet = True
if finish_packet == True:
packets.append(Packet(pkt_lines, control, transfer))
pkt_lines = []
finish_packet = False
if in_packet == True:
pkt_lines.append(l)
if packet:
done = packet.add_line(l)
if done:
packets.append(packet)
packet = None
else:
packet = Packet(l, control, transfer)
if packet.direction == defs.TO_UNKNOWN:
packet = None
for p in packets:
p.show()