X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/516dbac2105d8195ba52f46f4d5d75d598868f45..6f93185537e17bebe27f42c8558338e7f04b7d68:/client/cmdlfem4x.c diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index d38c2543..1150595c 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -546,8 +546,10 @@ bool downloadSamplesEM(){ bool doPreambleSearch(size_t *startIdx){ // sanity check - if ( DemodBufferLen < EM_PREAMBLE_LEN) + if ( DemodBufferLen < EM_PREAMBLE_LEN) { + if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 demodbuffer too small"); return FALSE; + } // skip first two 0 bits as they might have been missed in the demod uint8_t preamble[EM_PREAMBLE_LEN] = {0,0,1,0,1,0}; @@ -571,7 +573,6 @@ bool doPreambleSearch(size_t *startIdx){ if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 preamble not found :: %d", *startIdx); return FALSE; } - return TRUE; } @@ -592,8 +593,8 @@ bool detectFSK(){ // PSK clocks should be easy to detect ( but difficult to demod a non-repeating pattern... ) bool detectPSK(){ int ans = GetPskClock("", FALSE, FALSE); - if (!ans) { - if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305: PSK clock failed"); + if (ans <= 0) { + if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305: PSK clock failed"); return FALSE; } PrintAndLog("PSK response possibly found, run `data rawd p1` to attempt to demod"); @@ -602,7 +603,7 @@ bool detectPSK(){ // try manchester - NOTE: ST only applies to T55x7 tags. bool detectASK_MAN(){ bool stcheck = FALSE; - int ans = ASKDemod_ext("0 0 0", TRUE, FALSE, 1, &stcheck); + int ans = ASKDemod_ext("0 0 0", FALSE, FALSE, 1, &stcheck); if (!ans) { if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305: ASK/Manchester Demod failed"); return FALSE; @@ -695,7 +696,7 @@ int CmdReadWord(const char *Cmd) { //attempt demod: //need 32 bits from a read word - return demodEM4x05resp(32); + return demodEM4x05resp(44); } int CmdWriteWord(const char *Cmd) {