aboutsummaryrefslogtreecommitdiff
path: root/decode/decode.py
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-01-21 12:55:16 -0600
committerDan Williams <dcbw@redhat.com>2012-01-21 12:55:16 -0600
commitc37fdf5f94711ffbdf966f2ab366bbd047dfc147 (patch)
tree6fdac73a3c57f1415dddb7002d018e7f27a06e25 /decode/decode.py
parenta9d6b5a8b62fc0fc07d7c3fab99b25c67474c68d (diff)
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.
Diffstat (limited to 'decode/decode.py')
-rwxr-xr-xdecode/decode.py34
1 files changed, 10 insertions, 24 deletions
diff --git a/decode/decode.py b/decode/decode.py
index 5be72cdc..7196f9de 100755
--- a/decode/decode.py
+++ b/decode/decode.py
@@ -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()