From: Franz Schnyder <[email protected]> As no new entries will be made to the Toradex product ID table, interactive config block creating should no longer depend on that table to accept a module ID.
Remove the interactive lookup against the product ID table and prompt directly for the module PID4 instead. Only check that the entered module ID does not exceed four digits. Signed-off-by: Franz Schnyder <[email protected]> --- board/toradex/common/tdx-cfg-block.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 0b1798dc812..9ddb944fc42 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -512,24 +512,16 @@ static int get_cfgblock_interactive(void) int len = 0; int ret = 0; unsigned int prodid; - int i, idx; - printf("Enabled modules:\n"); - for (i = 0; i < ARRAY_SIZE(toradex_modules); i++) { - if (toradex_modules[i].is_enabled) - printf(" %04d %s\n", toradex_modules[i].pid4, - toradex_modules[i].name); - } - - snprintf(message, sizeof(message), "Enter the module ID: "); + snprintf(message, sizeof(message), "Enter the module PID4: "); len = cli_readline(message); - prodid = dectoul(console_buffer, NULL); - idx = get_toradex_modules_idx(prodid); - if (!toradex_modules[idx].pid4 || !toradex_modules[idx].is_enabled) { - printf("Parsing module id failed\n"); - return -1; + if (len > 4) { + printf("Invalid module PID4. Too many digits\n"); + return -EINVAL; } + + prodid = dectoul(console_buffer, NULL); tdx_hw_tag.prodid = prodid; len = 0; -- 2.43.0
