From 48da8970b19ca181a58cbf8dfac3946162555229 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 16 Aug 2021 20:21:42 +0300 Subject: [PATCH] fix 14a exchange --- client/src/cmdhf14a.c | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 6e97b2815..8783da0d6 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -776,41 +776,10 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav *dataoutlen = 0; if (activateField) { - PacketResponseNG resp; - responseNum = 0; - - // Anticollision + SELECT card - SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - if (!silentMode) PrintAndLogEx(ERR, "Proxmark3 connection timeout."); - return 1; - } - - // check result - if (resp.oldarg[0] == 0) { - if (!silentMode) PrintAndLogEx(ERR, "No card in field."); - return 1; - } - - if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) { - if (!silentMode) PrintAndLogEx(ERR, "Card not in iso14443-4. res=%" PRId64 ".", resp.oldarg[0]); - return 1; - } - - if (resp.oldarg[0] == 2) { // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision - // get ATS - uint8_t rats[] = { 0xE0, 0x80 }; // FSDI=8 (FSD=256), CID=0 - SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0, rats, sizeof(rats)); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - if (!silentMode) PrintAndLogEx(ERR, "Proxmark3 connection timeout."); - return 1; - } - - if (resp.oldarg[0] == 0) { // ats_len - if (!silentMode) PrintAndLogEx(ERR, "Can't get ATS."); - return 1; - } - } + // select with no disconnect and set g_frame_len + int selres = SelectCard14443A_4(false, !silentMode, NULL); + if (selres != PM3_SUCCESS) + return selres; } if (leaveSignalON)