X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/c46ea881a42c2655f1201f0bb3d55c486f79d9b5..9206d3b0342c5d0a594715eab06f6db232329c8d:/client/cmdhf14a.c

diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c
index d1952672..577ee574 100644
--- a/client/cmdhf14a.c
+++ b/client/cmdhf14a.c
@@ -27,8 +27,6 @@
 #include "nonce2key/nonce2key.h"
 #include "cmdhf.h"
 
-#define llx PRIx64
-
 static int CmdHelp(const char *Cmd);
 static void waitCmd(uint8_t iLen);
 
@@ -576,7 +574,7 @@ int CmdHF14ASim(const char *Cmd)
 				int len = (resp.arg[1] > sizeof(data)) ? sizeof(data) : resp.arg[1];
 				memcpy(data, resp.d.asBytes, len);
 				tryMfk32(uid, data, key);
-				tryMfk32_moebius(uid, data, key);
+				//tryMfk32_moebius(uid, data, key);
 				//tryMfk64(uid, data, key);
 				PrintAndLog("--");
 			}
@@ -735,8 +733,8 @@ int CmdHF14ACmdRaw(const char *cmd) {
 	// Max buffer is USB_CMD_DATA_SIZE
 	datalen = (datalen > USB_CMD_DATA_SIZE) ? USB_CMD_DATA_SIZE : datalen;
 		
-    c.arg[1] = (datalen & 0xFFFF) | (numbits << 16);
-    memcpy(c.d.asBytes,data,datalen);
+    c.arg[1] = (datalen & 0xFFFF) | (uint32_t)(numbits << 16);
+    memcpy(c.d.asBytes, data, datalen);
 
 	clearCommandBuffer();
     SendCommand(&c);
@@ -751,26 +749,15 @@ int CmdHF14ACmdRaw(const char *cmd) {
 }
 
 static void waitCmd(uint8_t iSelect) {
-    uint8_t *recv;
     UsbCommand resp;
-    char *hexout;
+    uint16_t len = 0;
 
-    if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
-        recv = resp.d.asBytes;
-        uint8_t iLen = iSelect ? resp.arg[1] : resp.arg[0];
-        PrintAndLog("received %i octets",iLen);
-        if(!iLen)
+    if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {        
+        len = iSelect ? (resp.arg[1] & 0xffff) : (resp.arg[0]  & 0xffff);
+        PrintAndLog("received %i octets", len);
+        if(!len)
             return;
-        hexout = (char *)malloc(iLen * 3 + 1);
-        if (hexout != NULL) {
-            for (int i = 0; i < iLen; i++) { // data in hex
-                sprintf(&hexout[i * 3], "%02X ", recv[i]);
-            }
-            PrintAndLog("%s", hexout);
-            free(hexout);
-        } else {
-            PrintAndLog("malloc failed your client has low memory?");
-        }
+		PrintAndLog("%s", sprint_hex(resp.d.asBytes, len) );
     } else {
         PrintAndLog("timeout while waiting for reply.");
     }
@@ -790,7 +777,8 @@ static command_t CommandTable[] =
 
 int CmdHF14A(const char *Cmd) {
 	// flush
-	WaitForResponseTimeout(CMD_ACK,NULL,100);
+	clearCommandBuffer();
+	//WaitForResponseTimeout(CMD_ACK,NULL,100);
 
 	// parse
 	CmdsParse(CommandTable, Cmd);