def parse_file(self):
if self.path.endswith("gz"):
f = gzip.GzipFile(self.path)
else:
f = open(self.path)
tree = ET.parse(f)
f.close()
root = tree.getroot()
current_urbs = {}
for child in root:
p = USBPacket(child)
urb_id = p["usb.urb_id"]
urb_status = p["usb.urb_status"]
urb_type = p["usb.urb_type"]
if (urb_type == URB_TYPE_SUBMIT):
current_urbs[urb_id] = p
if (urb_type == URB_TYPE_COMPLETED):
if (urb_id not in current_urbs):
print("Urb id not present: {:x}".format(urb_id))
else:
submit = current_urbs[urb_id]
completed = p
self.usb_transaction(submit, completed)
del current_urbs[urb_id]
评论列表
文章目录