implemented ISO 15693 error message decoding and fixed error code offset

This commit is contained in:
dn337t@gmail.com 2012-05-17 13:25:50 +00:00
commit b4a9d8419f

View file

@ -134,10 +134,20 @@ static char* getTagInfo(uint8_t *uid) {
} }
// will return a clear-text message to an errorcode // return a clear-text message to an errorcode
static char* TagErrorStr(uint8_t error) { static char* TagErrorStr(uint8_t error) {
// TODO switch (error) {
return NULL; case 0x01: return "The command is not supported";
case 0x02: return "The command is not recognised";
case 0x03: return "The option is not supported.";
case 0x0f: return "Unknown error.";
case 0x10: return "The specified block is not available (doesnt exist).";
case 0x11: return "The specified block is already -locked and thus cannot be locked again";
case 0x12: return "The specified block is locked and its content cannot be changed.";
case 0x13: return "The specified block was not successfully programmed.";
case 0x14: return "The specified block was not successfully locked.";
default: return "Reserved for Future Use or Custom command error.";
}
} }
@ -312,7 +322,7 @@ int CmdHF15DumpMem(const char*Cmd) {
blocknum++; blocknum++;
// PrintAndLog("bn=%i",blocknum); // PrintAndLog("bn=%i",blocknum);
} else { } else {
PrintAndLog("Tag returned Error %i: %s",recv[0],TagErrorStr(recv[0])); PrintAndLog("Tag returned Error %i: %s",recv[1],TagErrorStr(recv[1]));
return 0; return 0;
} }
} // else PrintAndLog("crc"); } // else PrintAndLog("crc");
@ -324,7 +334,7 @@ int CmdHF15DumpMem(const char*Cmd) {
else if (r && ISO15_CRC_CHECK!=Crc(r->d.asBytes,r->arg[0])) else if (r && ISO15_CRC_CHECK!=Crc(r->d.asBytes,r->arg[0]))
PrintAndLog("CRC Failed"); PrintAndLog("CRC Failed");
else else
PrintAndLog("Tag returned Error %i: %s",recv[0],TagErrorStr(recv[0])); PrintAndLog("Tag returned Error %i: %s",recv[1],TagErrorStr(recv[1]));
return 0; return 0;
} }
@ -649,7 +659,7 @@ int CmdHF15CmdRead(const char *Cmd) {
} }
PrintAndLog("%s",output); PrintAndLog("%s",output);
} else { } else {
PrintAndLog("Tag returned Error %i: %s",recv[0],TagErrorStr(recv[0])); PrintAndLog("Tag returned Error %i: %s",recv[1],TagErrorStr(recv[1]));
} }
} else { } else {
PrintAndLog("CRC failed"); PrintAndLog("CRC failed");
@ -731,7 +741,7 @@ int CmdHF15CmdWrite(const char *Cmd) {
if (!(recv[0] & ISO15_RES_ERROR)) { if (!(recv[0] & ISO15_RES_ERROR)) {
PrintAndLog("OK"); PrintAndLog("OK");
} else { } else {
PrintAndLog("Tag returned Error %i: %s",recv[0],TagErrorStr(recv[0])); PrintAndLog("Tag returned Error %i: %s",recv[1],TagErrorStr(recv[1]));
} }
} else { } else {
PrintAndLog("CRC failed"); PrintAndLog("CRC failed");