This is an automated email from the ASF dual-hosted git repository.

kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 37d14334ee24eb2f9fb9dd360cc8f9d2253ce3db
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Mon Oct 19 10:24:56 2026 +0200

    flash_test: Fix parsing flash id
    
    When flash area commands were introduced
    parsing for commands that were intended for flash
    (not flash area) did not interpret flash id.
    
    Syntax with flash id != 0 stopped working
    
    flash 1 read 0 100
    
    Now old functionality is restored.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 test/flash_test/src/flash_test.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/test/flash_test/src/flash_test.c b/test/flash_test/src/flash_test.c
index acfae8fbf..0a3804a3a 100644
--- a/test/flash_test/src/flash_test.c
+++ b/test/flash_test/src/flash_test.c
@@ -102,11 +102,16 @@ flash_cli_cmd(const struct shell_cmd *cmd, int argc, char 
**argv,
         }
     } else {
         /* Try parse flash id if any, if not set 0 will be used */
-        if (argc == 2) {
+        if (argc >= 2) {
             devid = (int)parse_ull_bounds(argv[1], 0, 255, &rc);
             if (rc != 0) {
-                streamer_printf(streamer, "Invalid flash id %s\n", argv[1]);
-                return 0;
+                if (argc == 2) {
+                    streamer_printf(streamer, "Invalid flash id %s\n", 
argv[1]);
+                    return 0;
+                }
+                /* No flash id, argv[1] is a command, use flash 0 */
+                devid = 0;
+                arg_idx--;
             }
         }
     }

Reply via email to