chg: hf mf nack - keep sync if started without card over antenna

This commit is contained in:
iceman1001 2019-05-15 08:20:04 -04:00
commit 088d34eb3e

View file

@ -2844,7 +2844,7 @@ void DetectNACKbug() {
WDT_HIT(); WDT_HIT();
// Test if the action was cancelled // Test if the action was cancelled
if (BUTTON_PRESS()) { if (BUTTON_PRESS() || usb_poll_validate_length()) {
status = PM3_EOPABORTED; status = PM3_EOPABORTED;
break; break;
} }
@ -2853,7 +2853,8 @@ void DetectNACKbug() {
if (!have_uid) { // need a full select cycle to get the uid first if (!have_uid) { // need a full select cycle to get the uid first
iso14a_card_select_t card_info; iso14a_card_select_t card_info;
if (!iso14443a_select_card(uid, &card_info, &cuid, true, 0, true)) { if (!iso14443a_select_card(uid, &card_info, &cuid, true, 0, true)) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Mifare: Can't select card (ALL)"); if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Mifare: Can't select card (ALL)");
i = 0;
continue; continue;
} }
switch (card_info.uidlen) { switch (card_info.uidlen) {
@ -2867,12 +2868,16 @@ void DetectNACKbug() {
cascade_levels = 3; cascade_levels = 3;
break; break;
default: default:
break; i = 0;
have_uid = false;
continue;
} }
have_uid = true; have_uid = true;
} else { // no need for anticollision. We can directly select the card } else { // no need for anticollision. We can directly select the card
if (!iso14443a_fast_select_card(uid, cascade_levels)) { if (!iso14443a_fast_select_card(uid, cascade_levels)) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Mifare: Can't select card (UID)"); if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Mifare: Can't select card (UID)");
i = 0;
have_uid = false;
continue; continue;
} }
} }