From d82a1e0739ebd37022f9b8be2e8031e41536af38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 23 May 2026 12:09:13 +0200 Subject: [PATCH] script: jtag_autoinit returns success, count via last_data_value It returned the loaded-BSDL count, which the engine flagged as an error code ("Command failed with code: 1") whenever a BSDL matched. Stash the count in last_data_value and return JTAG_CORE_NO_ERROR instead. --- modules/script/script.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/script/script.c b/modules/script/script.c index 18cb653..3013d1e 100644 --- a/modules/script/script.c +++ b/modules/script/script.c @@ -1575,7 +1575,10 @@ static int cmd_autoinit(script_ctx *ctx, char *line) return JTAG_CORE_ACCESS_ERROR; } - return loaded_bsdl; + // Expose the count to scripts via last_data_value, but report success + // (a non-zero return is treated as an error code by the engine). + ctx->last_data_value = loaded_bsdl; + return JTAG_CORE_NO_ERROR; } const char *cmd_init_and_scan_help[] = {