diff --git a/client/cmdlfparadox.c b/client/cmdlfparadox.c index 5f0f3e0ea..35c888497 100644 --- a/client/cmdlfparadox.c +++ b/client/cmdlfparadox.c @@ -22,18 +22,18 @@ static int CmdHelp(const char *Cmd); int usage_lf_paradox_sim(void) { - PrintAndLog("Enables simulation of Paradox card with specified card number."); - PrintAndLog("Simulation runs until the button is pressed or another USB command is issued."); - PrintAndLog("The facility-code is 8-bit and the card number is 16-bit. Larger values are truncated."); - PrintAndLog(""); - PrintAndLog("Usage: lf paradox sim [h] "); - PrintAndLog("Options:"); - PrintAndLog(" h : this help"); - PrintAndLog(" : 8-bit value facility code"); - PrintAndLog(" : 16-bit value card number"); - PrintAndLog(""); - PrintAndLog("Examples:"); - PrintAndLog(" lf paradox sim 123 11223"); + PrintAndLogEx(NORMAL, "Enables simulation of Paradox card with specified card number."); + PrintAndLogEx(NORMAL, "Simulation runs until the button is pressed or another USB command is issued."); + PrintAndLogEx(NORMAL, "The facility-code is 8-bit and the card number is 16-bit. Larger values are truncated."); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(NORMAL, "Usage: lf paradox sim [h] "); + PrintAndLogEx(NORMAL, "Options:"); + PrintAndLogEx(NORMAL, " h : this help"); + PrintAndLogEx(NORMAL, " : 8-bit value facility code"); + PrintAndLogEx(NORMAL, " : 16-bit value card number"); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(NORMAL, "Examples:"); + PrintAndLogEx(NORMAL, " lf paradox sim 123 11223"); return 0; } @@ -83,7 +83,7 @@ int CmdParadoxDemod(const char *Cmd) { uint8_t bits[MAX_GRAPH_TRACE_LEN]={0}; size_t size = getFromGraphBuf(bits); if (size==0) { - PrintAndLog("DEBUG: Error - Paradox not enough samples"); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); return 0; } @@ -94,17 +94,17 @@ int CmdParadoxDemod(const char *Cmd) { if (idx < 0){ if (g_debugMode){ if (idx == -1){ - PrintAndLog("DEBUG: Error - Paradox not enough samples"); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); } else if (idx == -2) { - PrintAndLog("DEBUG: Error - Paradox just noise detected"); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox just noise detected"); } else if (idx == -3) { - PrintAndLog("DEBUG: Error - Paradox problem during FSK demod"); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod"); } else if (idx == -4) { - PrintAndLog("DEBUG: Error - Paradox preamble not found"); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found"); } else if (idx == -5) { - PrintAndLog("DEBUG: Error - Paradox error in Manchester data, size %d", size); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %d", size); } else { - PrintAndLog("DEBUG: Error - Paradox error demoding fsk %d", idx); + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx); } } return 0; @@ -114,7 +114,7 @@ int CmdParadoxDemod(const char *Cmd) { setClockGrid(50, waveIdx + (idx*50)); if (hi2==0 && hi==0 && lo==0){ - if (g_debugMode) PrintAndLog("DEBUG: Error - Paradox no value found"); + if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox no value found"); return 0; } @@ -124,7 +124,7 @@ int CmdParadoxDemod(const char *Cmd) { uint32_t rawHi = bytebits_to_byte(bits + idx + 32, 32); uint32_t rawHi2 = bytebits_to_byte(bits + idx, 32); - PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x", + PrintAndLogEx(NORMAL, "Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x", hi >> 10, (hi & 0x3)<<26 | (lo>>10), fc, cardnum, @@ -135,7 +135,7 @@ int CmdParadoxDemod(const char *Cmd) { ); if (g_debugMode){ - PrintAndLog("DEBUG: Paradox idx: %d, len: %d, Printing Demod Buffer:", idx, size); + PrintAndLogEx(DEBUG, "DEBUG: Paradox idx: %d, len: %d, Printing Demod Buffer:", idx, size); printDemodBuff(); } return 1; @@ -171,18 +171,18 @@ int CmdParadoxSim(const char *Cmd) { cardnumber = (cn & 0x0000FFFF); // if ( !GetParadoxBits(facilitycode, cardnumber, bs)) { - // PrintAndLog("Error with tag bitstream generation."); + // PrintAndLogEx(WARNING, "Error with tag bitstream generation."); // return 1; // } - PrintAndLog("Simulating Paradox - Facility Code: %u, CardNumber: %u", facilitycode, cardnumber ); + PrintAndLogEx(NORMAL, "Simulating Paradox - Facility Code: %u, CardNumber: %u", facilitycode, cardnumber ); UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}}; memcpy(c.d.asBytes, bs, size); clearCommandBuffer(); SendCommand(&c); - PrintAndLog("UNFINISHED"); + PrintAndLogEx(NORMAL, "UNFINISHED"); return 0; } diff --git a/client/cmdlfpcf7931.c b/client/cmdlfpcf7931.c index e7b63c4b3..59ef1c818 100644 --- a/client/cmdlfpcf7931.c +++ b/client/cmdlfpcf7931.c @@ -44,53 +44,53 @@ int pcf7931_resetConfig(){ } int pcf7931_printConfig(){ - PrintAndLog("Password (LSB first on bytes) : %s", sprint_hex( configPcf.Pwd, sizeof(configPcf.Pwd))); - PrintAndLog("Tag initialization delay : %d us", configPcf.InitDelay); - PrintAndLog("Offset low pulses width : %d us", configPcf.OffsetWidth); - PrintAndLog("Offset low pulses position : %d us", configPcf.OffsetPosition); + PrintAndLogEx(NORMAL, "Password (LSB first on bytes) : %s", sprint_hex( configPcf.Pwd, sizeof(configPcf.Pwd))); + PrintAndLogEx(NORMAL, "Tag initialization delay : %d us", configPcf.InitDelay); + PrintAndLogEx(NORMAL, "Offset low pulses width : %d us", configPcf.OffsetWidth); + PrintAndLogEx(NORMAL, "Offset low pulses position : %d us", configPcf.OffsetPosition); return 0; } int usage_pcf7931_read(){ - PrintAndLog("Usage: lf pcf7931 read [h] "); - PrintAndLog("This command tries to read a PCF7931 tag."); - PrintAndLog("Options:"); - PrintAndLog(" h This help"); - PrintAndLog("Examples:"); - PrintAndLog(" lf pcf7931 read"); + PrintAndLogEx(NORMAL, "Usage: lf pcf7931 read [h] "); + PrintAndLogEx(NORMAL, "This command tries to read a PCF7931 tag."); + PrintAndLogEx(NORMAL, "Options:"); + PrintAndLogEx(NORMAL, " h This help"); + PrintAndLogEx(NORMAL, "Examples:"); + PrintAndLogEx(NORMAL, " lf pcf7931 read"); return 0; } int usage_pcf7931_write(){ - PrintAndLog("Usage: lf pcf7931 write [h] "); - PrintAndLog("This command tries to write a PCF7931 tag."); - PrintAndLog("Options:"); - PrintAndLog(" h This help"); - PrintAndLog(" blockaddress Block to save [0-7]"); - PrintAndLog(" byteaddress Index of byte inside block to write [0-15]"); - PrintAndLog(" data one byte of data (hex)"); - PrintAndLog("Examples:"); - PrintAndLog(" lf pcf7931 write 2 1 FF"); + PrintAndLogEx(NORMAL, "Usage: lf pcf7931 write [h] "); + PrintAndLogEx(NORMAL, "This command tries to write a PCF7931 tag."); + PrintAndLogEx(NORMAL, "Options:"); + PrintAndLogEx(NORMAL, " h This help"); + PrintAndLogEx(NORMAL, " blockaddress Block to save [0-7]"); + PrintAndLogEx(NORMAL, " byteaddress Index of byte inside block to write [0-15]"); + PrintAndLogEx(NORMAL, " data one byte of data (hex)"); + PrintAndLogEx(NORMAL, "Examples:"); + PrintAndLogEx(NORMAL, " lf pcf7931 write 2 1 FF"); return 0; } int usage_pcf7931_config(){ - PrintAndLog("Usage: lf pcf7931 config [h] [r] "); - PrintAndLog("This command tries to set the configuration used with PCF7931 commands"); - PrintAndLog("The time offsets could be useful to correct slew rate generated by the antenna"); - PrintAndLog("Caling without some parameter will print the current configuration."); - PrintAndLog("Options:"); - PrintAndLog(" h This help"); - PrintAndLog(" r Reset configuration to default values"); - PrintAndLog(" pwd Password, hex, 7bytes, LSB-order"); - PrintAndLog(" delay Tag initialization delay (in us) decimal"); - PrintAndLog(" offset Low pulses width (in us) decimal"); - PrintAndLog(" offset Low pulses position (in us) decimal"); - PrintAndLog("Examples:"); - PrintAndLog(" lf pcf7931 config"); - PrintAndLog(" lf pcf7931 config r"); - PrintAndLog(" lf pcf7931 config 11223344556677 20000"); - PrintAndLog(" lf pcf7931 config 11223344556677 17500 -10 30"); + PrintAndLogEx(NORMAL, "Usage: lf pcf7931 config [h] [r] "); + PrintAndLogEx(NORMAL, "This command tries to set the configuration used with PCF7931 commands"); + PrintAndLogEx(NORMAL, "The time offsets could be useful to correct slew rate generated by the antenna"); + PrintAndLogEx(NORMAL, "Caling without some parameter will print the current configuration."); + PrintAndLogEx(NORMAL, "Options:"); + PrintAndLogEx(NORMAL, " h This help"); + PrintAndLogEx(NORMAL, " r Reset configuration to default values"); + PrintAndLogEx(NORMAL, " pwd Password, hex, 7bytes, LSB-order"); + PrintAndLogEx(NORMAL, " delay Tag initialization delay (in us) decimal"); + PrintAndLogEx(NORMAL, " offset Low pulses width (in us) decimal"); + PrintAndLogEx(NORMAL, " offset Low pulses position (in us) decimal"); + PrintAndLogEx(NORMAL, "Examples:"); + PrintAndLogEx(NORMAL, " lf pcf7931 config"); + PrintAndLogEx(NORMAL, " lf pcf7931 config r"); + PrintAndLogEx(NORMAL, " lf pcf7931 config 11223344556677 20000"); + PrintAndLogEx(NORMAL, " lf pcf7931 config 11223344556677 17500 -10 30"); return 0; } @@ -104,7 +104,7 @@ int CmdLFPCF7931Read(const char *Cmd){ clearCommandBuffer(); SendCommand(&c); if ( !WaitForResponseTimeout(CMD_ACK, &resp, 2500) ) { - PrintAndLog("command execution time out"); + PrintAndLogEx(WARNING, "command execution time out"); return 1; } return 0; @@ -141,9 +141,9 @@ int CmdLFPCF7931Write(const char *Cmd){ data = param_get8ex(Cmd, 2, 0, 16); - PrintAndLog("Writing block: %d", block); - PrintAndLog(" pos: %d", bytepos); - PrintAndLog(" data: 0x%02X", data); + PrintAndLogEx(NORMAL, "Writing block: %d", block); + PrintAndLogEx(NORMAL, " pos: %d", bytepos); + PrintAndLogEx(NORMAL, " data: 0x%02X", data); UsbCommand c = {CMD_PCF7931_WRITE, { block, bytepos, data} }; memcpy(c.d.asDwords, configPcf.Pwd, sizeof(configPcf.Pwd) );