steve tell
2015-06-10 18:02:50 UTC
From b0943a01300b972df2ba5a6e461e51efc5c33e73 Mon Sep 17 00:00:00 2001
From: Steve Tell <***@telltronics.org>Date: Wed, 10 Jun 2015 13:34:26 -0400
Subject: [PATCH 2/2] In "detect", throw an error at the end if any of the several warnings
have been printed in the the loop. If the loop doesn't complete normally,
the part file won't be included and the detect result won't be usable
anyway.
---
urjtag/src/tap/detect.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c
index 5c13950..783ce8f 100644
--- a/urjtag/src/tap/detect.c
+++ b/urjtag/src/tap/detect.c
@@ -185,6 +185,7 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path, int maxirlen)
urj_tap_register_t *all_ids;
urj_parts_t *ps;
int i;
+ int error = 0;
char data_path[1024];
char manufacturer[URJ_PART_MANUFACTURER_MAXLEN + 1];
@@ -336,6 +337,7 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path, int maxirlen)
_("Unknown manufacturer!"),
urj_tap_register_get_string (key), data_path);
urj_tap_register_free (key);
+ error = 1;
continue;
}
@@ -366,6 +368,7 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path, int maxirlen)
_("Unknown part!"),
urj_tap_register_get_string (key), data_path);
urj_tap_register_free (key);
+ error = 1;
continue;
}
@@ -396,6 +399,7 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path, int maxirlen)
_("Unknown stepping!"),
urj_tap_register_get_string (key), data_path);
urj_tap_register_free (key);
+ error = 1;
continue;
}
urj_tap_register_free (key);
@@ -454,6 +458,7 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path, int maxirlen)
{
urj_log (URJ_LOG_LEVEL_NORMAL,
_("Error: Unable to detect JTAG chain end!\n"));
+ error = 1;
break;
}
}
@@ -466,7 +471,13 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path, int maxirlen)
urj_tap_register_free (id);
urj_tap_register_free (all_ids);
- return ps->len;
+ if(error)
+ {
+ urj_error_set (URJ_ERROR_NO_CHAIN, "detect failed or unknown parts");
+ return -1;
+ }
+ else
+ return ps->len;
}
--
1.7.1
------------------------------------------------------------------------------
1.7.1
------------------------------------------------------------------------------