cosmetics

This commit is contained in:
tharexde 2020-11-20 22:03:19 +01:00
parent e642c05e5c
commit 86b9d2c620
2 changed files with 12 additions and 22 deletions

View file

@ -1078,7 +1078,7 @@ void em4x50_stdread(void) {
// set gHigh and gLow
if (get_signalproperties() && find_em4x50_tag())
standard_read(&now, words);
LOW(GPIO_SSC_DOUT);
lf_finalize();
reply_ng(CMD_LF_EM4X50_STDREAD, now, (uint8_t *)words, 4 * now);
@ -1180,7 +1180,6 @@ static int write(uint32_t word, uint32_t addresses) {
// for saving data and should return with ACK
if (check_ack(false))
return PM3_SUCCESS;
}
}
} else {
@ -1224,7 +1223,6 @@ static int write_password(uint32_t password, uint32_t new_password) {
if (check_ack(false))
if (check_ack(false))
return PM3_SUCCESS;
}
}
} else {
@ -1232,7 +1230,7 @@ static int write_password(uint32_t password, uint32_t new_password) {
Dbprintf("error in command request");
}
return PM3_ESOFT;
return PM3_EFAILED;
}
void em4x50_write(em4x50_data_t *etd) {

View file

@ -1187,10 +1187,11 @@ int CmdEM4x50Restore(const char *Cmd) {
int uidLen = 0, fnLen = 0, pwdLen = 0, status = 0;
uint8_t pwd[4] = {0x0}, uid[4] = {0x0};
uint8_t data[DUMP_FILESIZE] = {0x0};
size_t bytes_read = 0;
char filename[FILE_PATH_SIZE] = {0};
em4x50_data_t etd = {.pwd_given = false};
uint8_t data[DUMP_FILESIZE] = {0x0};
PacketResponseNG resp;
CLIParserContext *ctx;
CLIParserInit(&ctx, "lf em 4x50_restore",
@ -1260,25 +1261,20 @@ int CmdEM4x50Restore(const char *Cmd) {
clearCommandBuffer();
SendCommandNG(CMD_LF_EM4X50_RESTORE, (uint8_t *)&etd, sizeof(etd));
PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_LF_EM4X50_RESTORE, &resp, 2 * TIMEOUT)) {
PrintAndLogEx(FAILED, "Timeout while waiting for reply.");
return PM3_ETIMEOUT;
}
status = resp.status;
if (status == PM3_ETEAROFF) {
return PM3_SUCCESS;
} else if (status != PM3_SUCCESS) {
if (status == PM3_SUCCESS)
PrintAndLogEx(SUCCESS, "Restore " _GREEN_("ok"));
else
PrintAndLogEx(FAILED, "Restore " _RED_("failed"));
return status;
}
PrintAndLogEx(SUCCESS, "Restore " _GREEN_("ok"));
PrintAndLogEx(INFO, "Finished restoring");
return PM3_SUCCESS;
return status;
}
//==============================================================================
@ -1343,16 +1339,12 @@ int CmdEM4x50Sim(const char *Cmd) {
clearCommandBuffer();
SendCommandNG(CMD_LF_EM4X50_SIM, 0, 0);
WaitForResponse(CMD_LF_EM4X50_SIM, &resp);
if (resp.status == PM3_ETEAROFF) {
return PM3_SUCCESS;
} else if (resp.status == PM3_ENODATA) {
if (resp.status == PM3_SUCCESS)
PrintAndLogEx(INFO, "Done");
else
PrintAndLogEx(FAILED, "No valid em4x50 data in flash memory.");
return PM3_ENODATA;
}
PrintAndLogEx(INFO, "Done");
return PM3_SUCCESS;
return resp.status;
}