libflashprog: Use newer APIs within flashprog_flash_probe()
We start using the new flashprog_chips_probe() enumeration API.
Handling of multiple chips, i.e. logging their names, is taken
from `cli_classic`. When a chip name is given, we'll skip the
enumeration and call the new flashprog_flash_probe_chip().
Change-Id: I11dea1e8d6973ce8d9565778c25f2196cb98561c
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/485
diff --git a/cli_config.c b/cli_config.c
index f713712..5275fe2 100644
--- a/cli_config.c
+++ b/cli_config.c
@@ -236,7 +236,11 @@
if (flashprog_programmer_init(&prog, flash_args.prog_name, flash_args.prog_args))
goto free_ret;
- if (flashprog_flash_probe(&flash, prog, flash_args.chip)) {
+ ret = flashprog_flash_probe(&flash, prog, flash_args.chip);
+ if (ret == 3) {
+ fprintf(stderr, "Please specify which chip definition to use with the -c <chipname> option.\n");
+ goto shutdown_ret;
+ } else if (ret) {
fprintf(stderr, "No EEPROM/flash device found.\n");
goto shutdown_ret;
}