mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix #1175 - biphase demod identification of value clocks now fails if no changes detected
This commit is contained in:
parent
f8925aa5f3
commit
02c1034caa
1 changed files with 23 additions and 5 deletions
|
@ -41,6 +41,8 @@
|
||||||
#include <stdlib.h> // qsort
|
#include <stdlib.h> // qsort
|
||||||
#include "parity.h" // for parity test
|
#include "parity.h" // for parity test
|
||||||
#include "pm3_cmd.h" // error codes
|
#include "pm3_cmd.h" // error codes
|
||||||
|
#include "commonutil.h" // Arraylen
|
||||||
|
|
||||||
// **********************************************************************************************
|
// **********************************************************************************************
|
||||||
// ---------------------------------Utilities Section--------------------------------------------
|
// ---------------------------------Utilities Section--------------------------------------------
|
||||||
// **********************************************************************************************
|
// **********************************************************************************************
|
||||||
|
@ -770,6 +772,22 @@ int DetectASKClock(uint8_t *dest, size_t size, int *clock, int maxErr) {
|
||||||
//if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, # Errors %d, Current Best Clk %d, bestStart %d", clk[k], bestErr[k], clk[best], bestStart[best]);
|
//if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, # Errors %d, Current Best Clk %d, bestStart %d", clk[k], bestErr[k], clk[best], bestStart[best]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool chg = false;
|
||||||
|
for (i = 0; i < ARRAYLEN(bestErr); i++) {
|
||||||
|
chg = (bestErr[i] != 1000);
|
||||||
|
if (chg)
|
||||||
|
break;
|
||||||
|
chg = (bestStart[i] != 0);
|
||||||
|
if (chg)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// just noise - no super good detection. good enough
|
||||||
|
if (chg == false) {
|
||||||
|
if (g_debugMode == 2) prnt("DEBUG DetectASKClock: no good values detected - aborting");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
if (!found_clk)
|
if (!found_clk)
|
||||||
*clock = clk[best];
|
*clock = clk[best];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue