From 7a27c1840cf1e244083c7b04bfb8e0f783d23a39 Mon Sep 17 00:00:00 2001
From: "Brian S. Dean" <bsd@bsdhome.com>
Date: Tue, 26 Jul 2005 02:56:29 +0000
Subject: [PATCH] The stk500v2_getsync() function was improperly checking for
 success, thus it was falsely reporting that it failed when it was actually
 working correctly.  Fixed.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@482 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 avrdude/stk500v2.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/avrdude/stk500v2.c b/avrdude/stk500v2.c
index fe7f2635..859205e7 100644
--- a/avrdude/stk500v2.c
+++ b/avrdude/stk500v2.c
@@ -237,7 +237,15 @@ retry:
 
   // if we got bytes returned, check to see what came back
   if (status > 0) {
-    if (resp[0] == STATUS_CMD_OK) {
+    if ((resp[0] == CMD_SIGN_ON) && (resp[1] == STATUS_CMD_OK)) {
+#if 0
+      int i;
+      fprintf(stderr, "found programmer type: ");
+      for (i=0; i<resp[2]; i++) {
+        fprintf(stderr, "%c", resp[3+i]);
+      }
+      fprintf(stderr, "\n");
+#endif
       // success!
       return 0;
     } else {