mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +02:00
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:
@@ -8,27 +8,29 @@ from typing import Optional
|
|||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from idf_py_actions.tools import PropertyDict
|
from idf_py_actions.tools import PropertyDict
|
||||||
from idf_py_actions.tools import RunTool
|
from idf_py_actions.tools import RunTool
|
||||||
from idf_py_actions.tools import yellow_print
|
from idf_py_actions.tools import yellow_print
|
||||||
|
|
||||||
|
|
||||||
def diag(action: str,
|
def diag(
|
||||||
ctx: click.core.Context,
|
action: str,
|
||||||
args: PropertyDict,
|
ctx: click.core.Context,
|
||||||
debug: bool,
|
args: PropertyDict,
|
||||||
log_prefix: bool,
|
debug: bool,
|
||||||
force: bool,
|
log_prefix: bool,
|
||||||
no_color: bool,
|
force: bool,
|
||||||
zip_directory: Optional[str],
|
no_color: bool,
|
||||||
list_recipes: bool,
|
zip_directory: Optional[str],
|
||||||
check_recipes: bool,
|
list_recipes: bool,
|
||||||
cmdl_recipes: Tuple,
|
check_recipes: bool,
|
||||||
cmdl_tags: Tuple,
|
cmdl_recipes: Tuple,
|
||||||
purge_file: Optional[str],
|
cmdl_tags: Tuple,
|
||||||
append: bool,
|
purge_file: Optional[str],
|
||||||
output: Optional[str]) -> None:
|
append: bool,
|
||||||
|
output: Optional[str],
|
||||||
|
) -> None:
|
||||||
diag_args: list = [sys.executable, '-m', 'esp_idf_diag']
|
diag_args: list = [sys.executable, '-m', 'esp_idf_diag']
|
||||||
|
|
||||||
def add_common_arguments(diag_args: list) -> None:
|
def add_common_arguments(diag_args: list) -> None:
|
||||||
@@ -100,6 +102,17 @@ def diag(action: str,
|
|||||||
diag_args += ['--force']
|
diag_args += ['--force']
|
||||||
if purge_file:
|
if purge_file:
|
||||||
diag_args += ['--purge', 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:
|
try:
|
||||||
RunTool('idf_diag', diag_args, args.project_dir, hints=not args.no_hints)()
|
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,
|
'multiple': True,
|
||||||
'metavar': 'RECIPE',
|
'metavar': 'RECIPE',
|
||||||
'type': str,
|
'type': str,
|
||||||
'help': ('Recipe to use. This option can be specified multiple times. '
|
'help': (
|
||||||
'By default, all built-in recipes are used. RECIPE refers to '
|
'Recipe to use. This option can be specified multiple times. '
|
||||||
'the recipe file path or the file name stem for built-in recipes.'),
|
'By default, all built-in recipes are used. RECIPE refers to '
|
||||||
|
'the recipe file path or the file name stem for built-in recipes.'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'names': ['-t', '--tag', 'cmdl_tags'],
|
'names': ['-t', '--tag', 'cmdl_tags'],
|
||||||
'multiple': True,
|
'multiple': True,
|
||||||
'metavar': 'TAG',
|
'metavar': 'TAG',
|
||||||
'type': str,
|
'type': str,
|
||||||
'help': ('Consider only recipes containing TAG. This option can be specified '
|
'help': (
|
||||||
'multiple times. By default, all recipes are used. Use -l/--list-recipes '
|
'Consider only recipes containing TAG. This option can be specified '
|
||||||
'option to see recipe TAG information.'),
|
'multiple times. By default, all recipes are used. Use -l/--list-recipes '
|
||||||
|
'option to see recipe TAG information.'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'names': ['-a', '--append'],
|
'names': ['-a', '--append'],
|
||||||
'is_flag': True,
|
'is_flag': True,
|
||||||
'help': ('Use recipes specified with the -r/--recipe option in '
|
'help': (
|
||||||
'combination with the built-in recipes.'),
|
'Use recipes specified with the -r/--recipe option in '
|
||||||
|
'combination with the built-in recipes.'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'names': ['-f', '--force'],
|
'names': ['-f', '--force'],
|
||||||
@@ -189,16 +208,18 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
|
|||||||
'names': ['-o', '--output'],
|
'names': ['-o', '--output'],
|
||||||
'metavar': 'PATH',
|
'metavar': 'PATH',
|
||||||
'type': str,
|
'type': str,
|
||||||
'help': ('Diagnostic report directory PATH or zip file archive PATH. '
|
'help': (
|
||||||
'If not specified, the report-UUID is used as the report directory, '
|
'Diagnostic report directory PATH or zip file archive PATH. '
|
||||||
'and the report directory specified with the --zip option with a zip '
|
'If not specified, the report-UUID is used as the report directory, '
|
||||||
'extension is used for the zip file archive.')
|
'and the report directory specified with the --zip option with a zip '
|
||||||
|
'extension is used for the zip file archive.'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'names': ['-p', '--purge', 'purge_file'],
|
'names': ['-p', '--purge', 'purge_file'],
|
||||||
'metavar': 'PATH',
|
'metavar': 'PATH',
|
||||||
'type': str,
|
'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.'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user