From 3c2dffa6019dafd7d39fbe0b5941402ae8b04d15 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 20 Dec 2024 16:42:43 +0100 Subject: [PATCH] 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 --- scripts/tracing/trace_capture_usb.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/tracing/trace_capture_usb.py b/scripts/tracing/trace_capture_usb.py index dd82adf207a..f75c8f739d7 100644 --- a/scripts/tracing/trace_capture_usb.py +++ b/scripts/tracing/trace_capture_usb.py @@ -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)