From 51ce0872bb611a1df8d00c92dae6169f5ef3168e Mon Sep 17 00:00:00 2001 From: Lech Date: Wed, 14 Mar 2018 23:21:13 +0100 Subject: [PATCH] NfcAuthenticator: support all valid tag types --- NfcAuthenticator.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NfcAuthenticator.cpp b/NfcAuthenticator.cpp index 872edb7..f4b7374 100644 --- a/NfcAuthenticator.cpp +++ b/NfcAuthenticator.cpp @@ -20,7 +20,7 @@ Key NfcAuthenticator::getKey() return Key(); uint8_t *nuid = rfid.uid.uidByte; - logger.debug("Mifare Classic tag detected, NUID: %02hhX %02hhX %02hhX %02hhX", nuid[0], nuid[1], nuid[2], nuid[3]); + logger.debug("NFC tag detected, NUID: %02hhX %02hhX %02hhX %02hhX", nuid[0], nuid[1], nuid[2], nuid[3]); releaseCard(); @@ -36,14 +36,13 @@ bool NfcAuthenticator::initializeCard() return false; auto piccType = rfid.PICC_GetType(rfid.uid.sak); - if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI && - piccType != MFRC522::PICC_TYPE_MIFARE_1K && - piccType != MFRC522::PICC_TYPE_MIFARE_4K) + if (piccType == MFRC522::PICC_TYPE_NOT_COMPLETE) { - logger.warning("Invalid Mifare tag type: %s", rfid.PICC_GetTypeName(piccType)); + logger.warning("Incomplete UID detected in SAK procedure"); return false; } + logger.debug("Tag type: %d", static_cast(piccType)); return true; }