From ac970064d31f13c474c23d9ac555521d4afee8a8 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 6 Nov 2023 00:19:45 +0200 Subject: [PATCH] add timeout error --- client/src/cmdhfmf.c | 5 ++++- client/src/mifare/mifarehost.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 35bf6e699..47a0bdb74 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -7465,7 +7465,10 @@ static int CmdHF14AGen4Info(const char *cmd) { size_t resplen = 0; int res = mfG4GetConfig(pwd, resp, &resplen, verbose); if (res != PM3_SUCCESS || resplen == 0) { - PrintAndLogEx(ERR, "Error get config. Maybe not a Gen4 card?. error=%d rlen=%d", res, resplen); + if (res == PM3_ETIMEOUT) + PrintAndLogEx(ERR, "No card in the field or card command timeout."); + else + PrintAndLogEx(ERR, "Error get config. Maybe not a Gen4 card?. error=%d rlen=%d", res, resplen); return PM3_ESOFT; } diff --git a/client/src/mifare/mifarehost.c b/client/src/mifare/mifarehost.c index f18b103cb..b6fd7e22b 100644 --- a/client/src/mifare/mifarehost.c +++ b/client/src/mifare/mifarehost.c @@ -1257,7 +1257,7 @@ int mfG4GetConfig(uint8_t *pwd, uint8_t *data, size_t *datalen, bool verbose) { int res = mfG4ExCommand(GEN4_CMD_DUMP_CONFIG, pwd, NULL, 0, resp, &resplen, verbose); if (res != PM3_SUCCESS) { - return PM3_EUNDEF; + return res; } if (data != NULL) @@ -1275,7 +1275,7 @@ int mfG4GetFactoryTest(uint8_t *pwd, uint8_t *data, size_t *datalen, bool verbos int res = mfG4ExCommand(GEN4_CMD_FACTORY_TEST, pwd, NULL, 0, resp, &resplen, verbose); if (res != PM3_SUCCESS) { - return PM3_EUNDEF; + return res; } if (data != NULL)