CHG: removed old TRUE/FALSE defines... some left still..

This commit is contained in:
iceman1001 2017-07-27 09:28:43 +02:00
parent 86bbd8f563
commit 46a0ec7130
21 changed files with 66 additions and 67 deletions

View file

@ -1499,9 +1499,10 @@ void __attribute__((noreturn)) AppMain(void)
for(;;) { for(;;) {
if ( usb_poll_validate_length() ) { if ( usb_poll_validate_length() ) {
rx_len = usb_read(rx, sizeof(UsbCommand)); rx_len = usb_read(rx, sizeof(UsbCommand));
Dbprintf("ice recive len: %u", rx_len);
if (rx_len) if (rx_len) {
UsbPacketReceived(rx, rx_len); UsbPacketReceived(rx, rx_len);
}
} }
WDT_HIT(); WDT_HIT();

View file

@ -218,7 +218,7 @@ void frame_sendAsReader(uint32_t data, uint8_t bits){
// log // log
uint8_t cmdbytes[] = {bits, BYTEx(data,0), BYTEx(data,1), BYTEx(data,2), BYTEx(send,0), BYTEx(send,1), BYTEx(send,2)}; uint8_t cmdbytes[] = {bits, BYTEx(data,0), BYTEx(data,1), BYTEx(data,2), BYTEx(send,0), BYTEx(send,1), BYTEx(send,2)};
LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, TRUE); LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, true);
} }
/* Receive a frame from the card in reader emulation mode, the FPGA and /* Receive a frame from the card in reader emulation mode, the FPGA and
@ -291,7 +291,7 @@ static void frame_receiveAsReader(struct legic_frame * const f, uint8_t bits) {
// log // log
uint8_t cmdbytes[] = {bits, BYTEx(data, 0), BYTEx(data, 1)}; uint8_t cmdbytes[] = {bits, BYTEx(data, 0), BYTEx(data, 1)};
LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, FALSE); LogTrace(cmdbytes, sizeof(cmdbytes), starttime, GET_TICKS, NULL, false);
} }
// Setup pm3 as a Legic Reader // Setup pm3 as a Legic Reader
@ -460,7 +460,7 @@ OUT: ;
legic_prng_forward(1); legic_prng_forward(1);
uint8_t cmdbytes[] = {1, isOK, BYTEx(steps, 0), BYTEx(steps, 1) }; uint8_t cmdbytes[] = {1, isOK, BYTEx(steps, 0), BYTEx(steps, 1) };
LogTrace(cmdbytes, sizeof(cmdbytes), start, GET_TICKS, NULL, FALSE); LogTrace(cmdbytes, sizeof(cmdbytes), start, GET_TICKS, NULL, false);
return isOK; return isOK;
} }
@ -833,7 +833,7 @@ void LegicRfSimulate(int phase, int frame, int reqresp)
cardmem = BigBuf_get_EM_addr(); cardmem = BigBuf_get_EM_addr();
clear_trace(); clear_trace();
set_tracing(TRUE); set_tracing(true);
crc_init(&legic_crc, 4, 0x19 >> 1, 0x5, 0); crc_init(&legic_crc, 4, 0x19 >> 1, 0x5, 0);
@ -1163,7 +1163,7 @@ static struct {
// break; // break;
// } // }
// return FALSE; // return false;
// } // }
/* /*
@ -1362,7 +1362,7 @@ static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq)
if(s == 0x000) { if(s == 0x000) {
// This is EOF (start, stop and all data bits == '0' // This is EOF (start, stop and all data bits == '0'
return TRUE; return true;
} }
} }
} }
@ -1375,7 +1375,7 @@ static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq)
LED_C_OFF(); LED_C_OFF();
break; break;
} }
return FALSE; return false;
} }
*/ */
/* /*
@ -1409,7 +1409,7 @@ static void DemodInit(uint8_t *data) {
static void GetSamplesForLegicDemod(int n, bool quiet) static void GetSamplesForLegicDemod(int n, bool quiet)
{ {
int max = 0; int max = 0;
bool gotFrame = FALSE; bool gotFrame = false;
int lastRxCounter = LEGIC_DMA_BUFFER_SIZE; int lastRxCounter = LEGIC_DMA_BUFFER_SIZE;
int ci, cq, samples = 0; int ci, cq, samples = 0;
@ -1478,7 +1478,7 @@ static void DemodInit(uint8_t *data) {
//Tracing //Tracing
if (Demod.len > 0) { if (Demod.len > 0) {
uint8_t parity[MAX_PARITY_SIZE] = {0x00}; uint8_t parity[MAX_PARITY_SIZE] = {0x00};
LogTrace(Demod.output, Demod.len, 0, 0, parity, FALSE); LogTrace(Demod.output, Demod.len, 0, 0, parity, false);
} }
} }
@ -1583,7 +1583,7 @@ static void CodeLegicBitsAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits)
TransmitForLegic(); TransmitForLegic();
if (tracing) { if (tracing) {
uint8_t parity[1] = {0x00}; uint8_t parity[1] = {0x00};
LogTrace(cmd, cmdlen, 0, 0, parity, TRUE); LogTrace(cmd, cmdlen, 0, 0, parity, true);
} }
} }
@ -1596,7 +1596,7 @@ void ice_legic_setup() {
FpgaDownloadAndGo(FPGA_BITSTREAM_HF); FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
BigBuf_free(); BigBuf_Clear_ext(false); BigBuf_free(); BigBuf_Clear_ext(false);
clear_trace(); clear_trace();
set_tracing(TRUE); set_tracing(true);
DemodReset(); DemodReset();
UartReset(); UartReset();

View file

@ -1817,7 +1817,7 @@ void Cotag(uint32_t arg0) {
switch(rawsignal) { switch(rawsignal) {
case 0: doCotagAcquisition(50000); break; case 0: doCotagAcquisition(50000); break;
case 1: doCotagAcquisitionManchester(); break; case 1: doCotagAcquisitionManchester(); break;
case 2: DoAcquisition_config(TRUE); break; case 2: DoAcquisition_config(true); break;
} }
// Turn the field off // Turn the field off

View file

@ -14,7 +14,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "mifarecmd.h" #include "mifarecmd.h"
#include <inttypes.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Select, Authenticate, Read a MIFARE tag. // Select, Authenticate, Read a MIFARE tag.
// read block // read block
@ -957,8 +957,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) {
uint8_t keyType = (arg0 >> 8) & 0xFF; uint8_t keyType = (arg0 >> 8) & 0xFF;
bool clearTrace = arg1 & 0xFF; bool clearTrace = arg1 & 0xFF;
uint8_t keyCount = arg2; uint8_t keyCount = arg2;
uint64_t ui64Key = 0; uint64_t key = 0;
bool have_uid = false; bool have_uid = false;
uint8_t cascade_levels = 0; uint8_t cascade_levels = 0;
uint32_t timeout = 0; uint32_t timeout = 0;
@ -1012,9 +1011,8 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) {
} }
} }
ui64Key = bytes_to_num(datain + i * 6, 6); key = bytes_to_num(datain + i * 6, 6);
if (mifare_classic_auth(pcs, cuid, blockNo, keyType, key, AUTH_FIRST)) {
if (mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) {
uint8_t dummy_answer = 0; uint8_t dummy_answer = 0;
ReaderTransmit(&dummy_answer, 1, NULL); ReaderTransmit(&dummy_answer, 1, NULL);

View file

@ -8,7 +8,7 @@
// Analyse bytes commands // Analyse bytes commands
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "cmdanalyse.h" #include "cmdanalyse.h"
#include "nonce2key/nonce2key.h" //#include "nonce2key/nonce2key.h"
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
@ -438,12 +438,12 @@ uint64_t d2[] = {0x6e442129, 0x8f699195, 0x0000004, 0x00040f0f0305030e};
uid(3e172b29) nt(039b7bd2) ks(0c0e0f0505080800) nr(00000001) uid(3e172b29) nt(039b7bd2) ks(0c0e0f0505080800) nr(00000001)
uid(3e172b29) nt(039b7bd2) ks(0e06090d03000b0f) nr(00000002) uid(3e172b29) nt(039b7bd2) ks(0e06090d03000b0f) nr(00000002)
*/ */
uint64_t key = 0; // uint64_t key = 0;
uint64_t d1[] = {0x3e172b29, 0x039b7bd2, 0x0000001, 0x0c0e0f0505080800}; // uint64_t d1[] = {0x3e172b29, 0x039b7bd2, 0x0000001, 0x0c0e0f0505080800};
uint64_t d2[] = {0x3e172b29, 0x039b7bd2, 0x0000002, 0x0e06090d03000b0f}; // uint64_t d2[] = {0x3e172b29, 0x039b7bd2, 0x0000002, 0x0e06090d03000b0f};
nonce2key_ex(0, 0 , d1[0], d1[1], d1[2], d1[3], &key); // nonce2key_ex(0, 0 , d1[0], d1[1], d1[2], d1[3], &key);
nonce2key_ex(0, 0 , d2[0], d2[1], d2[2], d2[3], &key); // nonce2key_ex(0, 0 , d2[0], d2[1], d2[2], d2[3], &key);
return 0; return 0;
} }

View file

@ -497,8 +497,8 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo )
int AskEm410xDemod(const char *Cmd, uint32_t *hi, uint64_t *lo, bool verbose) int AskEm410xDemod(const char *Cmd, uint32_t *hi, uint64_t *lo, bool verbose)
{ {
bool st = TRUE; bool st = true;
if (!ASKDemod_ext(Cmd, FALSE, FALSE, 1, &st)) return 0; if (!ASKDemod_ext(Cmd, false, false, 1, &st)) return 0;
return AskEm410xDecode(verbose, hi, lo); return AskEm410xDecode(verbose, hi, lo);
} }
@ -751,7 +751,7 @@ int Cmdaskbiphdemod(const char *Cmd)
char cmdp = param_getchar(Cmd, 0); char cmdp = param_getchar(Cmd, 0);
if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ab(); if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ab();
return ASKbiphaseDemod(Cmd, TRUE); return ASKbiphaseDemod(Cmd, true);
} }
//by marshmellow //by marshmellow
@ -761,7 +761,7 @@ int Cmdaskbiphdemod(const char *Cmd)
//if successful it will push askraw data back to demod buffer ready for emulation //if successful it will push askraw data back to demod buffer ready for emulation
int CmdG_Prox_II_Demod(const char *Cmd) int CmdG_Prox_II_Demod(const char *Cmd)
{ {
if (!ASKbiphaseDemod(Cmd, FALSE)){ if (!ASKbiphaseDemod(Cmd, false)){
if (g_debugMode) PrintAndLog("DEBUG: Error - gProxII ASKbiphaseDemod failed 1st try"); if (g_debugMode) PrintAndLog("DEBUG: Error - gProxII ASKbiphaseDemod failed 1st try");
return 0; return 0;
} }
@ -802,7 +802,7 @@ int CmdG_Prox_II_Demod(const char *Cmd)
uint32_t raw1 = bytebits_to_byte(DemodBuffer+ans,32); uint32_t raw1 = bytebits_to_byte(DemodBuffer+ans,32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer+ans+32, 32); uint32_t raw2 = bytebits_to_byte(DemodBuffer+ans+32, 32);
uint32_t raw3 = bytebits_to_byte(DemodBuffer+ans+64, 32); uint32_t raw3 = bytebits_to_byte(DemodBuffer+ans+64, 32);
bool unknown = FALSE; bool unknown = false;
switch(fmtLen) { switch(fmtLen) {
case 36: case 36:
FC = ((ByteStream[3] & 0x7F)<<7) | (ByteStream[4]>>1); FC = ((ByteStream[3] & 0x7F)<<7) | (ByteStream[4]>>1);
@ -813,7 +813,7 @@ int CmdG_Prox_II_Demod(const char *Cmd)
Card = ((ByteStream[4]&0x7F)<<9) | (ByteStream[5]<<1) | (ByteStream[6]>>7); Card = ((ByteStream[4]&0x7F)<<9) | (ByteStream[5]<<1) | (ByteStream[6]>>7);
break; break;
default : default :
unknown = TRUE; unknown = true;
break; break;
} }
if ( !unknown) if ( !unknown)
@ -917,8 +917,8 @@ int CmdAutoCorr(const char *Cmd)
PrintAndLog("window must be smaller than trace (%d samples)", GraphTraceLen); PrintAndLog("window must be smaller than trace (%d samples)", GraphTraceLen);
return 0; return 0;
} }
if (grph == 'g') updateGrph = TRUE; if (grph == 'g') updateGrph = true;
return AutoCorrelate(window, updateGrph, TRUE); return AutoCorrelate(window, updateGrph, true);
} }
int CmdBitsamples(const char *Cmd) int CmdBitsamples(const char *Cmd)
@ -1164,7 +1164,7 @@ int CmdFSKrawdemod(const char *Cmd)
char cmdp = param_getchar(Cmd, 0); char cmdp = param_getchar(Cmd, 0);
if (strlen(Cmd) > 20 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_fs(); if (strlen(Cmd) > 20 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_fs();
return FSKrawDemod(Cmd, TRUE); return FSKrawDemod(Cmd, true);
} }
//by marshmellow (based on existing demod + holiman's refactor) //by marshmellow (based on existing demod + holiman's refactor)

View file

@ -1195,7 +1195,7 @@ int CmdLFfind(const char *Cmd) {
if (testRaw=='u' || testRaw=='U'){ if (testRaw=='u' || testRaw=='U'){
//test unknown tag formats (raw mode) //test unknown tag formats (raw mode)
PrintAndLog("\nChecking for Unknown tags:\n"); PrintAndLog("\nChecking for Unknown tags:\n");
ans=AutoCorrelate(4000, FALSE, FALSE); ans=AutoCorrelate(4000, false, false);
if (ans > 0) { if (ans > 0) {
@ -1232,8 +1232,8 @@ int CmdLFfind(const char *Cmd) {
return 1; return 1;
} }
} }
bool st = TRUE; bool st = true;
ans=ASKDemod_ext("0 0 0",TRUE,FALSE,1,&st); ans=ASKDemod_ext("0 0 0",true,false,1,&st);
if (ans>0) { if (ans>0) {
PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!"); PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!");
PrintAndLog("\nif it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab'"); PrintAndLog("\nif it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab'");

View file

@ -127,7 +127,7 @@ int CmdAWIDDemodFSK(const char *Cmd) {
int CmdAWIDRead(const char *Cmd) { int CmdAWIDRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("12000", TRUE); getSamples("12000", true);
return CmdFSKdemodAWID(Cmd); return CmdFSKdemodAWID(Cmd);
} }

View file

@ -218,7 +218,7 @@ int CmdEM410xWrite(const char *Cmd)
bool EM_EndParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType) bool EM_EndParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType)
{ {
if (rows*cols>size) return FALSE; if (rows*cols>size) return false;
uint8_t colP=0; uint8_t colP=0;
//assume last col is a parity and do not test //assume last col is a parity and do not test
for (uint8_t colNum = 0; colNum < cols-1; colNum++) { for (uint8_t colNum = 0; colNum < cols-1; colNum++) {
@ -232,7 +232,7 @@ bool EM_EndParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t col
bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType) bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType)
{ {
if (rows*cols>size) return FALSE; if (rows*cols>size) return false;
uint8_t rowP=0; uint8_t rowP=0;
//assume last row is a parity row and do not test //assume last row is a parity row and do not test
for (uint8_t rowNum = 0; rowNum < rows-1; rowNum++) { for (uint8_t rowNum = 0; rowNum < rows-1; rowNum++) {

View file

@ -195,7 +195,7 @@ int CmdFdxDemod(const char *Cmd) {
int CmdFdxRead(const char *Cmd) { int CmdFdxRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("12000", TRUE); getSamples("12000", true);
return CmdFdxDemod(Cmd); return CmdFdxDemod(Cmd);
} }

View file

@ -138,7 +138,7 @@ int GetGuardBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *guardBits) {
int CmdGuardRead(const char *Cmd) { int CmdGuardRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("12000", TRUE); getSamples("12000", true);
return CmdG_Prox_II_Demod(""); return CmdG_Prox_II_Demod("");
} }

View file

@ -126,7 +126,7 @@ int CmdJablotronDemod(const char *Cmd) {
int CmdJablotronRead(const char *Cmd) { int CmdJablotronRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("10000", TRUE); getSamples("10000", true);
return CmdJablotronDemod(Cmd); return CmdJablotronDemod(Cmd);
} }

View file

@ -203,7 +203,7 @@ lf t55xx wr b 4 d 4c0003ff
int CmdLFNedapRead(const char *Cmd) { int CmdLFNedapRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("12000", TRUE); getSamples("12000", true);
return CmdLFNedapDemod(""); return CmdLFNedapDemod("");
} }
/* /*

View file

@ -76,7 +76,7 @@ int CmdNexWatchRead(const char *Cmd) {
//lf_read(true, 10000); //lf_read(true, 10000);
CmdLFRead("s"); CmdLFRead("s");
getSamples("10000",TRUE); getSamples("10000",true);
// demod and output viking ID // demod and output viking ID
return CmdPSKNexWatch(Cmd); return CmdPSKNexWatch(Cmd);

View file

@ -150,7 +150,7 @@ int CmdNoralsyDemod(const char *Cmd) {
int CmdNoralsyRead(const char *Cmd) { int CmdNoralsyRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("8000",TRUE); getSamples("8000",true);
return CmdNoralsyDemod(Cmd); return CmdNoralsyDemod(Cmd);
} }

View file

@ -79,7 +79,7 @@ int CmdPacDemod(const char *Cmd) {
int CmdPacRead(const char *Cmd) { int CmdPacRead(const char *Cmd) {
//lf_read(true, 4096*2 + 20); //lf_read(true, 4096*2 + 20);
CmdLFRead("s"); CmdLFRead("s");
getSamples("8192",TRUE); getSamples("8192",true);
return CmdPacDemod(Cmd); return CmdPacDemod(Cmd);
} }

View file

@ -159,7 +159,7 @@ int CmdPrescoRead(const char *Cmd) {
// read lf silently // read lf silently
CmdLFRead("s"); CmdLFRead("s");
// get samples silently // get samples silently
getSamples("12000", TRUE); getSamples("12000", true);
// demod and output Presco ID // demod and output Presco ID
return CmdPrescoDemod(Cmd); return CmdPrescoDemod(Cmd);
} }

View file

@ -75,7 +75,7 @@ int GetPyramidBits(uint32_t fc, uint32_t cn, uint8_t *pyramidBits) {
int CmdPyramidRead(const char *Cmd) { int CmdPyramidRead(const char *Cmd) {
CmdLFRead("s"); CmdLFRead("s");
getSamples("12000", TRUE); getSamples("12000", true);
return CmdFSKdemodPyramid(""); return CmdFSKdemodPyramid("");
} }

View file

@ -125,7 +125,7 @@ int CmdSecurakeyDemod(const char *Cmd) {
int CmdSecurakeyRead(const char *Cmd) { int CmdSecurakeyRead(const char *Cmd) {
//lf_read(true, 8000); //lf_read(true, 8000);
CmdLFRead("s"); CmdLFRead("s");
getSamples("8000",TRUE); getSamples("8000",true);
return CmdSecurakeyDemod(Cmd); return CmdSecurakeyDemod(Cmd);
} }

View file

@ -496,9 +496,9 @@ bool tryDetectModulation(){
int bitRate=0; int bitRate=0;
uint8_t fc1 = 0, fc2 = 0, clk=0; uint8_t fc1 = 0, fc2 = 0, clk=0;
if (GetFskClock("", FALSE, FALSE)){ if (GetFskClock("", false, false)){
fskClocks(&fc1, &fc2, &clk, FALSE); fskClocks(&fc1, &fc2, &clk, false);
if ( FSKrawDemod("0 0", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){ if ( FSKrawDemod("0 0", false) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){
tests[hits].modulation = DEMOD_FSK; tests[hits].modulation = DEMOD_FSK;
if (fc1==8 && fc2 == 5) if (fc1==8 && fc2 == 5)
tests[hits].modulation = DEMOD_FSK1a; tests[hits].modulation = DEMOD_FSK1a;
@ -570,23 +570,23 @@ bool tryDetectModulation(){
} }
//undo trim from ask //undo trim from ask
//save_restoreGB(0); //save_restoreGB(0);
clk = GetNrzClock("", FALSE, FALSE); clk = GetNrzClock("", false, false);
if (clk>0) { if (clk>0) {
if ( NRZrawDemod("0 0 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { if ( NRZrawDemod("0 0 1", false) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_NRZ; tests[hits].modulation = DEMOD_NRZ;
tests[hits].bitrate = bitRate; tests[hits].bitrate = bitRate;
tests[hits].inverted = FALSE; tests[hits].inverted = false;
tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer); tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);
tests[hits].ST = FALSE; tests[hits].ST = false;
++hits; ++hits;
} }
if ( NRZrawDemod("0 1 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { if ( NRZrawDemod("0 1 1", false) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_NRZ; tests[hits].modulation = DEMOD_NRZ;
tests[hits].bitrate = bitRate; tests[hits].bitrate = bitRate;
tests[hits].inverted = TRUE; tests[hits].inverted = true;
tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer); tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);
tests[hits].ST = FALSE; tests[hits].ST = false;
++hits; ++hits;
} }
} }
@ -595,9 +595,9 @@ bool tryDetectModulation(){
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise) // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)
save_restoreGB(1); save_restoreGB(1);
CmdLtrim("160"); CmdLtrim("160");
clk = GetPskClock("", FALSE, FALSE); clk = GetPskClock("", false, false);
if (clk>0) { if (clk>0) {
if ( PSKDemod("0 0 6", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) { if ( PSKDemod("0 0 6", false) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_PSK1; tests[hits].modulation = DEMOD_PSK1;
tests[hits].bitrate = bitRate; tests[hits].bitrate = bitRate;
tests[hits].inverted = false; tests[hits].inverted = false;

View file

@ -290,14 +290,14 @@ int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, uint8_
// UID // UID
memcpy(block0, uid, 4); memcpy(block0, uid, 4);
// Mifare UID BCC // Mifare UID BCC
block0[4] = block0[0]^block0[1]^block0[2]^block0[3]; block0[4] = block0[0] ^ block0[1] ^ block0[2] ^ block0[3];
// mifare classic SAK(byte 5) and ATQA(byte 6 and 7, reversed) // mifare classic SAK(byte 5) and ATQA(byte 6 and 7, reversed)
if ( sak != NULL ) if ( sak != NULL )
block0[5]=sak[0]; block0[5] = sak[0];
if ( atqa != NULL ) { if ( atqa != NULL ) {
block0[6]=atqa[1]; block0[6] = atqa[1];
block0[7]=atqa[0]; block0[7] = atqa[0];
} }
PrintAndLog("new block 0: %s", sprint_hex(block0,16)); PrintAndLog("new block 0: %s", sprint_hex(block0,16));