From 686d01b04df2ef1384a6bd737d88688a8f53c9b7 Mon Sep 17 00:00:00 2001 From: joerg_wunsch Date: Tue, 14 Dec 2010 17:17:33 +0000 Subject: [PATCH] In stk500v2_command(), detect warning status codes. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@951 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 4 ++++ stk500v2.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ChangeLog b/ChangeLog index 58a65f87..4b61c306 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-12-14 Joerg Wunsch + + * stk500v2.c (stk500v2_command): Detect warning status codes. + 2010-10-22 Nils Springob * serial.h: serial_open() calls will now return -1 on error (no call to exit()) diff --git a/stk500v2.c b/stk500v2.c index 62faacc9..fca8f7aa 100644 --- a/stk500v2.c +++ b/stk500v2.c @@ -800,6 +800,32 @@ retry: /* * Decode STK500v2 errors. */ + if (buf[1] >= STATUS_CMD_TOUT && buf[1] < 0xa0) { + const char *msg; + char msgbuf[30]; + switch (buf[1]) { + case STATUS_CMD_TOUT: + msg = "Command timed out"; + break; + + case STATUS_RDY_BSY_TOUT: + msg = "Sampling of the RDY/nBSY pin timed out"; + break; + + case STATUS_SET_PARAM_MISSING: + msg = "The `Set Device Parameters' have not been " + "executed in advance of this command"; + + default: + sprintf(msgbuf, "unknown, code 0x%02x", buf[1]); + msg = msgbuf; + break; + } + if (quell_progress < 2) + fprintf(stderr, "%s: stk500v2_command(): warning: %s\n", + progname, msg); + buf[1] = STATUS_CMD_OK; /* pretend success */ + } if (buf[1] == STATUS_CMD_OK) return status; if (buf[1] == STATUS_CMD_FAILED)