From acd7ccdbc9b98f2e10df25e7cf2a6d17824f1b7e Mon Sep 17 00:00:00 2001
From: iceman1001 <iceman@iuse.se>
Date: Sun, 1 Nov 2015 22:16:16 +0100
Subject: [PATCH 1/1] CHG: some magic generation1 tags is not following
 protocol and answers to the "halt" command. This gives an error and makes the
 users think something went wrong. This also affected the magic identification
 in "Hf 14a reader" command, where it in those moments stated "NO" even if the
 tag is indeed a generation1.

---
 armsrc/mifarecmd.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c
index 0b75ebc3..e51ae18b 100644
--- a/armsrc/mifarecmd.c
+++ b/armsrc/mifarecmd.c
@@ -1078,7 +1078,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 			};
 
 			if(mifare_classic_halt(NULL, cuid)) {
-				if (MF_DBGLEVEL >= 1)	Dbprintf("Halt error");
+				if (MF_DBGLEVEL >= 4)	Dbprintf("INFO - Tag answered the 'Halt' command");
 				break;
 			};
 		};	
@@ -1114,7 +1114,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 	
 		if (workFlags & 0x04) {
 			if (mifare_classic_halt(NULL, cuid)) {
-				if (MF_DBGLEVEL >= 1)	Dbprintf("Halt error");
+				if (MF_DBGLEVEL >= 4)	Dbprintf("INFO - Tag answered the 'Halt' command");
 				break;
 			};
 		}
@@ -1192,7 +1192,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 		
 		if (workFlags & 0x04) {
 			if (mifare_classic_halt(NULL, cuid)) {
-				if (MF_DBGLEVEL >= 1)	Dbprintf("Halt error");
+				if (MF_DBGLEVEL >= 4)	Dbprintf("INFO - Tag answered the 'Halt' command");
 				break;
 			};
 		}
@@ -1239,9 +1239,8 @@ void MifareCIdent(){
 		isOK = 0;
 	};
 
-	if (mifare_classic_halt(NULL, 0)) {
-		isOK = 0;
-	};
+	// removed the if,  since some magic tags misbehavies and send an answer to it.
+	mifare_classic_halt(NULL, 0);
 
 	cmd_send(CMD_ACK,isOK,0,0,0,0);
 }
-- 
2.39.5