Skip to content

Commit

Permalink
One more small change to resetting the ATQA value automatically depen…
Browse files Browse the repository at this point in the history
…ding on whether the UID is known to be randomly generated
  • Loading branch information
maxieds committed Jul 26, 2022
1 parent 2257c42 commit 3a91394
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 3a91394

Please sign in to comment.