]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfem4x.c
Merge remote-tracking branch 'upstream/master'
[proxmark3-svn] / client / cmdlfem4x.c
index 0788b13852a2d17592382267403fda4efdd25703..c26b4f392b7b04f2392c0ca3af704bfd7a1ad502 100644 (file)
@@ -540,7 +540,7 @@ bool EM4x05testDemodReadData(uint32_t *word, bool readCmd) {
        // sanity check
        size = (size > DemodBufferLen) ? DemodBufferLen : size;
        // test preamble
-       if ( !onePreambleSearch(DemodBuffer, preamble, sizeof(preamble), size, &startIdx) ) {
+       if ( !preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &size, &startIdx, true) ) {
                if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 preamble not found :: %d", startIdx);
                return false;
        }
@@ -550,13 +550,13 @@ bool EM4x05testDemodReadData(uint32_t *word, bool readCmd) {
                        if (g_debugMode) PrintAndLog("DEBUG: Error - End Parity check failed");
                        return false;
                }
-               // test for even parity bits.
-               if ( removeParity(DemodBuffer, startIdx + sizeof(preamble),9,0,44) == 0 ) {             
+               // test for even parity bits and remove them. (leave out the end row of parities so 36 bits)
+               if ( removeParity(DemodBuffer, startIdx + sizeof(preamble),9,0,36) == 0 ) {             
                        if (g_debugMode) PrintAndLog("DEBUG: Error - Parity not detected");
                        return false;
                }
 
-               setDemodBuf(DemodBuffer, 40, 0);
+               setDemodBuf(DemodBuffer, 32, 0);
                *word = bytebits_to_byteLSBF(DemodBuffer, 32);
        }
        return true;
Impressum, Datenschutz