use PrintAndLogEx() instead of PrintAndLog()

This commit is contained in:
Brian Pow 2018-02-21 16:14:47 +08:00
commit b1318c6e0c

View file

@ -166,9 +166,9 @@ int CmdTIDemod(const char *Cmd)
GraphBuffer[maxPos] = 800; GraphBuffer[maxPos] = 800;
GraphBuffer[maxPos+1] = -800; GraphBuffer[maxPos+1] = -800;
PrintAndLog("actual data bits start at sample %d", maxPos); PrintAndLogEx(NORMAL, "actual data bits start at sample %d", maxPos);
PrintAndLog("length %d/%d", highLen, lowLen); PrintAndLogEx(NORMAL, "length %d/%d", highLen, lowLen);
uint8_t bits[1+64+16+8+16]; uint8_t bits[1+64+16+8+16];
bits[sizeof(bits)-1] = '\0'; bits[sizeof(bits)-1] = '\0';
@ -209,19 +209,19 @@ int CmdTIDemod(const char *Cmd)
RepaintGraphWindow(); RepaintGraphWindow();
PrintAndLog("Info: raw tag bits = %s", bits); PrintAndLogEx(INFO, "INFO: raw tag bits = %s", bits);
TagType = (shift3>>8)&0xff; TagType = (shift3>>8)&0xff;
if ( TagType != ((shift0>>16)&0xff) ) { if ( TagType != ((shift0>>16)&0xff) ) {
PrintAndLog("Error: start and stop bits do not match!"); PrintAndLogEx(WARNING, "Error: start and stop bits do not match!");
return 0; return 0;
} }
else if (TagType == 0x7e) { else if (TagType == 0x7e) {
PrintAndLog("Info: Readonly TI tag detected."); PrintAndLogEx(INFO, "INFO: Readonly TI tag detected.");
return 0; return 0;
} }
else if (TagType == 0xfe) { else if (TagType == 0xfe) {
PrintAndLog("Info: Rewriteable TI tag detected."); PrintAndLogEx(INFO, "INFO: Rewriteable TI tag detected.");
// put 64 bit data into shift1 and shift0 // put 64 bit data into shift1 and shift0
shift0 = (shift0>>24) | (shift1 << 8); shift0 = (shift0>>24) | (shift1 << 8);
@ -235,7 +235,7 @@ int CmdTIDemod(const char *Cmd)
// only 15 bits compare, last bit of ident is not valid // only 15 bits compare, last bit of ident is not valid
if ( (shift3^shift0)&0x7fff ) { if ( (shift3^shift0)&0x7fff ) {
PrintAndLog("Error: Ident mismatch!"); PrintAndLogEx(WARNING, "Error: Ident mismatch!");
} }
// WARNING the order of the bytes in which we calc crc below needs checking // WARNING the order of the bytes in which we calc crc below needs checking
// i'm 99% sure the crc algorithm is correct, but it may need to eat the // i'm 99% sure the crc algorithm is correct, but it may need to eat the
@ -255,14 +255,14 @@ int CmdTIDemod(const char *Cmd)
char *crcStr = (crc == (shift2&0xffff) ) ? "Passed" : "Failed"; char *crcStr = (crc == (shift2&0xffff) ) ? "Passed" : "Failed";
PrintAndLog("Tag data = %08X%08X [Crc %04X %s]", shift1, shift0, crc, crcStr ); PrintAndLogEx(NORMAL, "Tag data = %08X%08X [Crc %04X %s]", shift1, shift0, crc, crcStr );
if (crc != (shift2&0xffff)) if (crc != (shift2&0xffff))
PrintAndLog("Error: CRC mismatch, calculated %04X, got %04X", crc, shift2&0xffff); PrintAndLogEx(WARNING, "Error: CRC mismatch, calculated %04X, got %04X", crc, shift2&0xffff);
} }
else { else {
PrintAndLog("Unknown tag type."); PrintAndLogEx(WARNING, "Unknown tag type.");
} }
return 0; return 0;
} }
@ -285,7 +285,7 @@ int CmdTIWrite(const char *Cmd)
if (res == 2) c.arg[2]=0; if (res == 2) c.arg[2]=0;
if (res < 2) { if (res < 2) {
PrintAndLog("Please specify the data as two hex strings, optionally the CRC as a third"); PrintAndLogEx(NORMAL, "Please specify the data as two hex strings, optionally the CRC as a third");
return 1; return 1;
} }
clearCommandBuffer(); clearCommandBuffer();