From: marshmellow42 Date: Mon, 27 Feb 2017 02:44:40 +0000 (-0500) Subject: adjust timeouts on lf read/lf search to no timeout if threshold was set. X-Git-Tag: v3.0.0~63^2~1 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/2b11c7c75068f6e25da5cc4ed463ff78b2cc8900 adjust timeouts on lf read/lf search to no timeout if threshold was set. NOTE: lf snoop already doesn't have a timeout... also adjusted PRIx64 to SCNx64 in em410xwrite --- diff --git a/client/cmdlf.c b/client/cmdlf.c index 5683a589..dc7185cc 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -35,7 +35,7 @@ #include "cmdlfviking.h" // for viking menu #include "cmdlfcotag.h" // for COTAG menu - +bool threshold_set = false; static int CmdHelp(const char *Cmd); @@ -510,7 +510,10 @@ int CmdLFSetConfig(const char *Cmd) case 't': errors |= param_getdec(Cmd,cmdp+1,&unsigned_trigg); cmdp+=2; - if(!errors) trigger_threshold = unsigned_trigg; + if(!errors) { + trigger_threshold = unsigned_trigg; + if (trigger_threshold > 0) threshold_set = true; + } break; case 'b': errors |= param_getdec(Cmd,cmdp+1,&bps); @@ -557,7 +560,7 @@ int CmdLFSetConfig(const char *Cmd) int CmdLFRead(const char *Cmd) { - + if (offline) return 0; uint8_t cmdp = 0; bool arg1 = false; if (param_getchar(Cmd, cmdp) == 'h') @@ -569,12 +572,14 @@ int CmdLFRead(const char *Cmd) UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, {arg1,0,0}}; clearCommandBuffer(); SendCommand(&c); - WaitForResponse(CMD_ACK,NULL); - //if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) { - // PrintAndLog("command execution time out"); - // return 1; - //} - + if (threshold_set) { + WaitForResponse(CMD_ACK,NULL); + } else { + if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) { + PrintAndLog("command execution time out"); + return 1; + } + } return 0; } diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 38bb5c5d..f9103126 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -183,7 +183,7 @@ int CmdEM410xWrite(const char *Cmd) int card = 0xFF; // invalid card value unsigned int clock = 0; // invalid clock value - sscanf(Cmd, "%" PRIx64 " %d %d", &id, &card, &clock); + sscanf(Cmd, "%" SCNx64 " %d %d", &id, &card, &clock); // Check ID if (id == 0xFFFFFFFFFFFFFFFF) {