From: Oleg Moiseenko <olegmsn@gmail.com>
Date: Fri, 12 Jan 2018 21:37:55 +0000 (+0200)
Subject: hf mf sniff: small fixes
X-Git-Tag: v3.1.0~88
X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/8ec06f5ef3c5c63a420b8292dd3ea5d0a5d6974e?hp=078e2bd238dfddb39c33de775f5e0a68657c4504

hf mf sniff: small fixes
---

diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c
index 94ca52f5..7d589f0e 100644
--- a/armsrc/iso14443a.c
+++ b/armsrc/iso14443a.c
@@ -2482,7 +2482,7 @@ void RAMFUNC SniffMifare(uint8_t param) {
 	for(uint32_t sniffCounter = 0; true; ) {
 	
 		if(BUTTON_PRESS()) {
-			DbpString("cancelled by button");
+			DbpString("Canceled by button.");
 			break;
 		}
 
@@ -2576,7 +2576,7 @@ void RAMFUNC SniffMifare(uint8_t param) {
 
 	} // main cycle
 
-	DbpString("COMMAND FINISHED");
+	DbpString("COMMAND FINISHED.");
 
 	FpgaDisableSscDma();
 	MfSniffEnd();
diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c
index 4956df8c..b653cf30 100644
--- a/client/cmdhfmf.c
+++ b/client/cmdhfmf.c
@@ -2527,14 +2527,13 @@ int CmdHF14AMfSniff(const char *Cmd){
 		}
 
 		UsbCommand resp;
-		if (WaitForResponseTimeout(CMD_ACK,&resp,2000)) {
+		if (WaitForResponseTimeoutW(CMD_ACK, &resp, 2000, false)) {
 			res = resp.arg[0] & 0xff;
 			uint16_t traceLen = resp.arg[1];
 			len = resp.arg[2];
 
 			if (res == 0) {								// we are done
-				free(buf);
-				return 0;
+				break;
 			}
 
 			if (res == 1) {								// there is (more) data to be transferred
@@ -2610,6 +2609,9 @@ int CmdHF14AMfSniff(const char *Cmd){
 	} // while (true)
 
 	free(buf);
+	
+	msleep(300); // wait for exiting arm side.
+	PrintAndLog("Done.");
 	return 0;
 }