scripts: trace_capture_usb: disable tracing on exit

Disable tracing on exit and do not discard data immediately after
enabling tracing. The length of the data depends on the timings of the
host and targets and may simply be an arbitrary length that does not fit
any trace format or frame.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2024-12-20 16:42:43 +01:00 committed by Henrik Brix Andersen
commit 3c2dffa601

View file

@ -82,10 +82,6 @@ def main():
#enable device tracing
write_endpoint.write('enable')
#try to read to avoid garbage mixed to useful stream data
buff = usb.util.create_buffer(8192)
read_endpoint.read(buff, 10000)
try:
with open(output_file, "wb") as file_desc:
while True:
@ -96,6 +92,7 @@ def main():
except KeyboardInterrupt:
pass
finally:
write_endpoint.write('disable')
print('Data capture interrupted, data saved into {}'.format(args.output))
usb.util.release_interface(usb_device, interface)