diff options
author | Paul Fertser <fercerpav@gmail.com> | 2014-11-02 15:03:16 +0300 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2015-01-09 08:36:06 +0000 |
commit | c120fb6d893a89d9805d0b4d6083e47810143f2d (patch) | |
tree | b07fdeae2e64181c515396b40136589f0ebd1274 | |
parent | 420bd49b5bc34a2306eb2e88fb01ec0f0bf2ee70 (diff) |
target: improve robustness of polling and reexamination
When a target was present on OpenOCD start but later disappeared for
whatever reason (typically unstable connection or target going to
sleep) and reappeared only for a brief period of time, reexamination
would fail, and poll would no longer run. This patch fixes it.
Change-Id: I61f9b5a3f366a761320e233f4e1689f926b5556d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2370
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
-rw-r--r-- | src/target/target.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c index d7a2c481..b74c6a0c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2425,7 +2425,13 @@ static int handle_target(void *priv) if (target->backoff.times > 0) { LOG_USER("Polling target %s succeeded again, trying to reexamine", target_name(target)); target_reset_examined(target); - target_examine_one(target); + retval = target_examine_one(target); + /* Target examination could have failed due to unstable connection, + * but we set the examined flag anyway to repoll it later */ + if (retval != ERROR_OK) { + target->examined = true; + return retval; + } } target->backoff.times = 0; |