Merge branch 'feat/diag_port' into 'master'

feat(diag): pass serial port to esp-idf-diag

See merge request espressif/esp-idf!39813
This commit is contained in:
Roland Dobai
2025-06-20 15:44:14 +02:00

View File

@@ -8,12 +8,14 @@ from typing import Optional
from typing import Tuple
import click
from idf_py_actions.tools import PropertyDict
from idf_py_actions.tools import RunTool
from idf_py_actions.tools import yellow_print
def diag(action: str,
def diag(
action: str,
ctx: click.core.Context,
args: PropertyDict,
debug: bool,
@@ -27,8 +29,8 @@ def diag(action: str,
cmdl_tags: Tuple,
purge_file: Optional[str],
append: bool,
output: Optional[str]) -> None:
output: Optional[str],
) -> None:
diag_args: list = [sys.executable, '-m', 'esp_idf_diag']
def add_common_arguments(diag_args: list) -> None:
@@ -100,6 +102,17 @@ 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)()
@@ -161,24 +174,30 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
'multiple': True,
'metavar': 'RECIPE',
'type': str,
'help': ('Recipe to use. This option can be specified multiple times. '
'help': (
'Recipe to use. This option can be specified multiple times. '
'By default, all built-in recipes are used. RECIPE refers to '
'the recipe file path or the file name stem for built-in recipes.'),
'the recipe file path or the file name stem for built-in recipes.'
),
},
{
'names': ['-t', '--tag', 'cmdl_tags'],
'multiple': True,
'metavar': 'TAG',
'type': str,
'help': ('Consider only recipes containing TAG. This option can be specified '
'help': (
'Consider only recipes containing TAG. This option can be specified '
'multiple times. By default, all recipes are used. Use -l/--list-recipes '
'option to see recipe TAG information.'),
'option to see recipe TAG information.'
),
},
{
'names': ['-a', '--append'],
'is_flag': True,
'help': ('Use recipes specified with the -r/--recipe option in '
'combination with the built-in recipes.'),
'help': (
'Use recipes specified with the -r/--recipe option in '
'combination with the built-in recipes.'
),
},
{
'names': ['-f', '--force'],
@@ -189,16 +208,18 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
'names': ['-o', '--output'],
'metavar': 'PATH',
'type': str,
'help': ('Diagnostic report directory PATH or zip file archive PATH. '
'help': (
'Diagnostic report directory PATH or zip file archive PATH. '
'If not specified, the report-UUID is used as the report directory, '
'and the report directory specified with the --zip option with a zip '
'extension is used for the zip file archive.')
'extension is used for the zip file archive.'
),
},
{
'names': ['-p', '--purge', 'purge_file'],
'metavar': 'PATH',
'type': str,
'help': ('Use a custom purge file to remove sensitive information from the report.')
'help': ('Use a custom purge file to remove sensitive information from the report.'),
},
],
},