From 4aa81bac9b70012464e0ef54758872ae86fe355a Mon Sep 17 00:00:00 2001
From: bsd <bsd@81a1dc3b-b13d-400b-aceb-764788c761c2>
Date: Fri, 1 Nov 2002 14:40:23 +0000
Subject: [PATCH] Be backward compatible with the 2-byte rewrite cycle counter
 which appeared in version 2.1.0, but was changed to a 4 byte counter in
 version 2.1.1.  Reminded by Joerg Wunsch.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@150 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 avr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/avr.c b/avr.c
index 5a282b66..df2b527d 100644
--- a/avr.c
+++ b/avr.c
@@ -1082,6 +1082,11 @@ int avr_get_cycle_count(int fd, AVRPART * p)
     return -1;
   }
 
+  if ((v1 == 0xff) && (v2 == 0xff) && (v3 != 0xff) && (v4 != 0xff)) {
+    v1 = 0;
+    v2 = 0;
+  }
+
   cycle_count = (((unsigned int)v1) << 24) | 
     (((unsigned int)v2) << 16) |
     (((unsigned int)v3) << 8) |