X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/a38f5a0704240efdf46ee423f0c9ed10a48b1078..4c8fe2e976f0330944e032231007feede2e32ff8:/common/lfdemod.c diff --git a/common/lfdemod.c b/common/lfdemod.c index 8b951dc8..910b2af4 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -350,9 +350,9 @@ int askdemod(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr //take 10 and 01 and manchester decode //run through 2 times and take least errCnt int manrawdecode(uint8_t * BitStream, size_t *size, uint8_t invert){ - uint16_t bitnum = 0, MaxBits = 512, errCnt = 0; + int errCnt = 0, bestErr = 1000; + uint16_t bitnum = 0, MaxBits = 512, bestRun = 0; size_t i, k; - uint16_t bestErr = 1000, bestRun = 0; if (*size < 16) return -1; //find correct start position [alignment] for (k=0; k < 2; ++k){ @@ -698,7 +698,7 @@ int VikingDemod_AM(uint8_t *dest, size_t *size) { // by iceman // find Visa2000 preamble in already demoded data int Visa2kDemod_AM(uint8_t *dest, size_t *size) { - if (*size < 96*2) return -1; //make sure buffer has data + if (*size < 96) return -1; //make sure buffer has data size_t startIdx = 0; uint8_t preamble[] = {0,1,0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,1,0}; uint8_t errChk = preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx); @@ -710,7 +710,7 @@ int Visa2kDemod_AM(uint8_t *dest, size_t *size) { // by iceman // find Noralsy preamble in already demoded data int NoralsyDemod_AM(uint8_t *dest, size_t *size) { - if (*size < 96*2) return -1; //make sure buffer has data + if (*size < 96) return -1; //make sure buffer has data size_t startIdx = 0; uint8_t preamble[] = {1,0,1,1,1,0,1,1,0,0,0,0}; uint8_t errChk = preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx);