move idteck to its own file
This commit is contained in:
@@ -1277,73 +1277,6 @@ int PSKDemod(int clk, int invert, int maxErr, bool verbose) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int demodIdteck(bool verbose) {
|
||||
(void) verbose; // unused so far
|
||||
if (PSKDemod(0, 0, 100, false) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck PSKDemod failed");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
size_t size = DemodBufferLen;
|
||||
|
||||
//get binary from PSK1 wave
|
||||
int idx = detectIdteck(DemodBuffer, &size);
|
||||
if (idx < 0) {
|
||||
|
||||
if (idx == -1)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: not enough samples");
|
||||
else if (idx == -2)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: just noise");
|
||||
else if (idx == -3)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
|
||||
else if (idx == -4)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
|
||||
else
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
|
||||
|
||||
// if didn't find preamble try again inverting
|
||||
if (PSKDemod(0, 1, 100, false) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck PSKDemod failed");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
idx = detectIdteck(DemodBuffer, &size);
|
||||
if (idx < 0) {
|
||||
|
||||
if (idx == -1)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: not enough samples");
|
||||
else if (idx == -2)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: just noise");
|
||||
else if (idx == -3)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
|
||||
else if (idx == -4)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
|
||||
else
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
|
||||
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
}
|
||||
setDemodBuff(DemodBuffer, 64, idx);
|
||||
|
||||
//got a good demod
|
||||
uint32_t id = 0;
|
||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
|
||||
|
||||
//parity check (TBD)
|
||||
//checksum check (TBD)
|
||||
|
||||
//output
|
||||
PrintAndLogEx(SUCCESS, "IDTECK Tag Found: Card ID %u , Raw: %08X%08X", id, raw1, raw2);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
static int CmdIdteckDemod(const char *Cmd) {
|
||||
(void)Cmd; // Cmd is not used so far
|
||||
return demodIdteck();
|
||||
}
|
||||
*/
|
||||
|
||||
// by marshmellow
|
||||
// takes 3 arguments - clock, invert, maxErr as integers
|
||||
// attempts to demodulate nrz only
|
||||
|
||||
Reference in New Issue
Block a user