From b2da8aae45cee6261048c207faf8d8a186915c4f Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Wed, 11 Jun 2025 16:52:18 +0200 Subject: [PATCH] feat(diag): pass serial port to esp-idf-diag If a port is specified for the idf.py command, pass it to esp-idf-diag. This ensures that the esptools used for gathering target information connect to the explicitly specified port rather than relying on autodetection. Signed-off-by: Frantisek Hrbata --- tools/idf_py_actions/diag_ext.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/idf_py_actions/diag_ext.py b/tools/idf_py_actions/diag_ext.py index 489e1525d1..0b472311a3 100644 --- a/tools/idf_py_actions/diag_ext.py +++ b/tools/idf_py_actions/diag_ext.py @@ -100,6 +100,13 @@ def diag(action: str, diag_args += ['--force'] if purge_file: diag_args += ['--purge', purge_file] + if args.port: + diag_args += ['--port', args.port] + else: + yellow_print( ( 'The target serial port is not specified, so ' + 'autodetection will be used. To set it manually, use ' + 'the "--port" option. Example: "idf.py --port ' + '/dev/ttyUSB0 diag".')) try: RunTool('idf_diag', diag_args, args.project_dir, hints=not args.no_hints)()