rename globals DemodBuffer and DemodBufferLen

This commit is contained in:
Philippe Teuwen committed 2021-08-21 17:12:50 +02:00
1 parent 45d4d361e9
commit e4fbfe0f40
34 files changed
+445 -445

No files matched your search

+10 -10
View File
@@ -105,8 +105,8 @@ int demodKeri(bool verbose) {
}
bool invert = false;
size_t size = DemodBufferLen;
int idx = detectKeri(DemodBuffer, &size, &invert);
size_t size = g_DemodBufferLen;
int idx = detectKeri(g_DemodBuffer, &size, &invert);
if (idx < 0) {
if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - KERI: too few bits found");
@@ -119,7 +119,7 @@ int demodKeri(bool verbose) {
return PM3_ESOFT;
}
setDemodBuff(DemodBuffer, size, idx);
setDemodBuff(g_DemodBuffer, size, idx);
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
/*
@@ -143,22 +143,22 @@ int demodKeri(bool verbose) {
uint32_t fc = 0;
uint32_t cardid = 0;
//got a good demod
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
uint32_t raw1 = bytebits_to_byte(g_DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(g_DemodBuffer + 32, 32);
if (invert) {
PrintAndLogEx(INFO, "Had to Invert - probably KERI");
for (size_t i = 0; i < size; i++)
DemodBuffer[i] ^= 1;
g_DemodBuffer[i] ^= 1;
raw1 = bytebits_to_byte(DemodBuffer, 32);
raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
raw1 = bytebits_to_byte(g_DemodBuffer, 32);
raw2 = bytebits_to_byte(g_DemodBuffer + 32, 32);
CmdPrintDemodBuff("-x");
}
//get internal id
// uint32_t ID = bytebits_to_byte(DemodBuffer + 29, 32);
// uint32_t ID = bytebits_to_byte(g_DemodBuffer + 29, 32);
// Due to the 3 sync bits being at the start of the capture
// We can take the last 32bits as the internal ID.
uint32_t ID = raw2;
@@ -391,7 +391,7 @@ int detectKeri(uint8_t *dest, size_t *size, bool *invert) {
found_size = *size;
// if didn't find preamble try again inverting
uint8_t preamble_i[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
if (!preambleSearch(DemodBuffer, preamble_i, sizeof(preamble_i), &found_size, &startIdx))
if (!preambleSearch(g_DemodBuffer, preamble_i, sizeof(preamble_i), &found_size, &startIdx))
return -2;
*invert ^= 1;