From 3a91394f12280c0ee80373502182f6bef3e12379 Mon Sep 17 00:00:00 2001 From: Maxie Dion Schmidt Date: Mon, 25 Jul 2022 20:39:50 -0400 Subject: [PATCH] One more small change to resetting the ATQA value automatically depending on whether the UID is known to be randomly generated --- .../Application/DESFire/DESFirePICCControl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Firmware/Chameleon-Mini/Application/DESFire/DESFirePICCControl.c b/Firmware/Chameleon-Mini/Application/DESFire/DESFirePICCControl.c index 03e37a4d..84934b42 100644 --- a/Firmware/Chameleon-Mini/Application/DESFire/DESFirePICCControl.c +++ b/Firmware/Chameleon-Mini/Application/DESFire/DESFirePICCControl.c @@ -366,12 +366,16 @@ void GetPiccUid(ConfigurationUidType Uid) { void SetPiccUid(ConfigurationUidType Uid) { memcpy(&Picc.Uid[0], Uid, DESFIRE_UID_SIZE); - DesfireATQAReset = true; - if (!DesfireATQAReset) { + if (!DesfireATQAReset && Uid[0] != ISO14443A_UID0_RANDOM) { uint16_t ATQAValue = DESFIRE_ATQA_DEFAULT; Picc.ATQA[0] = (uint8_t)((ATQAValue >> 8) & 0x00FF); Picc.ATQA[1] = (uint8_t)(ATQAValue & 0x00FF); DesfireATQAReset = true; + } else if (!DesfireATQAReset && Uid[0] == ISO14443A_UID0_RANDOM) { + uint16_t ATQAValue = DESFIRE_ATQA_RANDOM_UID; + Picc.ATQA[0] = (uint8_t)((ATQAValue >> 8) & 0x00FF); + Picc.ATQA[1] = (uint8_t)(ATQAValue & 0x00FF); + DesfireATQAReset = false; } SynchronizePICCInfo(); }