chg - returns

This commit is contained in:
iceman1001 2019-05-22 09:43:39 -04:00
commit e191dc777d

View file

@ -87,7 +87,7 @@ static int CmdTIDemod(const char *Cmd) {
int i, j, TagType; int i, j, TagType;
int lowSum = 0, highSum = 0;; int lowSum = 0, highSum = 0;;
int lowTot = 0, highTot = 0; int lowTot = 0, highTot = 0;
int retval = 0; int retval = PM3_ESOFT;
for (i = 0; i < GraphTraceLen - convLen; i++) { for (i = 0; i < GraphTraceLen - convLen; i++) {
lowSum = 0; lowSum = 0;
@ -216,7 +216,7 @@ static int CmdTIDemod(const char *Cmd) {
goto out; goto out;
} else if (TagType == 0x7E) { } else if (TagType == 0x7E) {
PrintAndLogEx(INFO, "Readonly TI tag detected."); PrintAndLogEx(INFO, "Readonly TI tag detected.");
retval = 1; retval = PM3_SUCCESS;
goto out; goto out;
} else if (TagType == 0xFE) { } else if (TagType == 0xFE) {
PrintAndLogEx(INFO, "Rewriteable TI tag detected."); PrintAndLogEx(INFO, "Rewriteable TI tag detected.");
@ -259,14 +259,14 @@ static int CmdTIDemod(const char *Cmd) {
if (crc != (shift2 & 0xFFFF)) if (crc != (shift2 & 0xFFFF))
PrintAndLogEx(WARNING, "Error: CRC mismatch, calculated %04X, got %04X", crc, shift2 & 0xFFFF); PrintAndLogEx(WARNING, "Error: CRC mismatch, calculated %04X, got %04X", crc, shift2 & 0xFFFF);
retval = 1; retval = PM3_SUCCESS;
goto out; goto out;
} else { } else {
PrintAndLogEx(WARNING, "Unknown tag type."); PrintAndLogEx(WARNING, "Unknown tag type.");
} }
out: out:
if (retval == 0) if (retval != PM3_SUCCESS)
save_restoreGB(GRAPH_RESTORE); save_restoreGB(GRAPH_RESTORE);
return retval; return retval;
@ -277,7 +277,7 @@ static int CmdTIRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far (void)Cmd; // Cmd is not used so far
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_READ_TI_TYPE, NULL, 0); SendCommandNG(CMD_READ_TI_TYPE, NULL, 0);
return 0; return PM3_SUCCESS;
} }
// write new data to a r/w TI tag // write new data to a r/w TI tag
@ -291,11 +291,11 @@ static int CmdTIWrite(const char *Cmd) {
if (res < 2) { if (res < 2) {
PrintAndLogEx(WARNING, "Please specify the data as two hex strings, optionally the CRC as a third"); PrintAndLogEx(WARNING, "Please specify the data as two hex strings, optionally the CRC as a third");
return 1; return PM3_EINVARG;
} }
clearCommandBuffer(); clearCommandBuffer();
SendCommandMIX(CMD_WRITE_TI_TYPE, arg0, arg1, arg2, NULL, 0); SendCommandMIX(CMD_WRITE_TI_TYPE, arg0, arg1, arg2, NULL, 0);
return 0; return PM3_SUCCESS;
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {
@ -309,7 +309,7 @@ static command_t CommandTable[] = {
static int CmdHelp(const char *Cmd) { static int CmdHelp(const char *Cmd) {
(void)Cmd; // Cmd is not used so far (void)Cmd; // Cmd is not used so far
CmdsHelp(CommandTable); CmdsHelp(CommandTable);
return 0; return PM3_SUCCESS;
} }
int CmdLFTI(const char *Cmd) { int CmdLFTI(const char *Cmd) {