make sure magic wipe cmd gets 2000ms timeout

This commit is contained in:
iceman1001 2020-09-07 10:21:29 +02:00
commit 289f1c234c

View file

@ -2063,12 +2063,19 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) {
break; break;
} }
uint32_t old_timeout = iso14a_get_timeout();
// 2000 ms timeout
// 13560000 / 1000 / (8 * 16) * timeout
iso14a_set_timeout(21190);
ReaderTransmit(wipeC, sizeof(wipeC), NULL); ReaderTransmit(wipeC, sizeof(wipeC), NULL);
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) { if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
if (DBGLEVEL >= DBG_ERROR) Dbprintf("wipeC error"); if (DBGLEVEL >= DBG_ERROR) Dbprintf("wipeC error");
errormsg = MAGIC_WIPE; errormsg = MAGIC_WIPE;
break; break;
} }
iso14a_set_timeout(old_timeout);
mifare_classic_halt_ex(NULL); mifare_classic_halt_ex(NULL);
} }