NfcAuthenticator: support all valid tag types
This commit is contained in:
parent
af6dcf2629
commit
51ce0872bb
|
@ -20,7 +20,7 @@ Key NfcAuthenticator::getKey()
|
||||||
return Key();
|
return Key();
|
||||||
|
|
||||||
uint8_t *nuid = rfid.uid.uidByte;
|
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();
|
releaseCard();
|
||||||
|
|
||||||
|
@ -36,14 +36,13 @@ bool NfcAuthenticator::initializeCard()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto piccType = rfid.PICC_GetType(rfid.uid.sak);
|
auto piccType = rfid.PICC_GetType(rfid.uid.sak);
|
||||||
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
|
if (piccType == MFRC522::PICC_TYPE_NOT_COMPLETE)
|
||||||
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
|
|
||||||
piccType != MFRC522::PICC_TYPE_MIFARE_4K)
|
|
||||||
{
|
{
|
||||||
logger.warning("Invalid Mifare tag type: %s", rfid.PICC_GetTypeName(piccType));
|
logger.warning("Incomplete UID detected in SAK procedure");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("Tag type: %d", static_cast<int>(piccType));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue