preserve hardened USB smoke evidence
This commit is contained in:
@@ -6,6 +6,7 @@ import csv
|
||||
import glob
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
from contextlib import ExitStack
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -27,6 +28,11 @@ def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--port", help="serial port; auto-detected when omitted")
|
||||
parser.add_argument("--baud", type=int, default=115200)
|
||||
parser.add_argument(
|
||||
"--reset",
|
||||
action="store_true",
|
||||
help="hard-reset the ESP32-C3 after opening the serial port",
|
||||
)
|
||||
parser.add_argument("--output", type=Path, help="validated binary .trk output")
|
||||
parser.add_argument("--csv", type=Path, help="decoded CSV output")
|
||||
parser.add_argument(
|
||||
@@ -109,6 +115,16 @@ def main() -> int:
|
||||
if args.wire is not None
|
||||
else None
|
||||
)
|
||||
if args.reset:
|
||||
# Match ESP-IDF monitor's USB Serial/JTAG hard-reset state:
|
||||
# release DTR/RTS first, discard the old session, pulse reset,
|
||||
# and keep this same reader open for the new boot stream.
|
||||
sensor.dtr = False
|
||||
sensor.rts = False
|
||||
sensor.reset_input_buffer()
|
||||
sensor.rts = True
|
||||
time.sleep(0.2)
|
||||
sensor.rts = False
|
||||
writer = csv.writer(decoded)
|
||||
writer.writerow(CSV_COLUMNS)
|
||||
while not stop_requested:
|
||||
|
||||
Reference in New Issue
Block a user