-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change Mfrc522.ReselectTarget to use WUPA instead of REQA #2061
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as well. Thanks for the heavy testing here.
What do I need to do in order to resolve the API compatibility errors (because of the new optional parameter to |
/// <returns>true if there is a card, else false.</returns> | ||
public bool IsCardPresent(byte[] atqa) | ||
public bool IsCardPresent(byte[] atqa, bool reselect = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: In order to not be binary breaking, any reason why we shouldn't just add new overloads as opposed to using default parameters?
You just rerun the pack command locally and pass in the property |
Thanks. I thought about creating an overload, but from a documentation perspective I think it is easier to understand the optional argument than the overloaded alternatives. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Mfrc522.ReselectTarget
is used to reselect a card, notably after an error occurs. It does aHALT
and then usesIsCardPresent
to reconnect with the card, which eventually usesREQA
. However, according to ISO 14443-3, if the card successfully executes aHALT
then it will not respond to aREQA
; instead, the PCD is required to useWUPA
(wakeup). As a result, ifReselectTarget
is called when the card is not in an error state, the card is non-responsive until it is taken out of range of the transceiver so that a completely new session can begin.This PR adds an optional
reselect
parameter (defaultfalse
) toIsCardPresent
and also adds an optionalcommandCode
parameter to the private functionPiccRequestA
to specify which command to send to the card.ReselectTarget
uses this to request reselection withWUPA
.With this change, it is now possible to halt and wake up cards. Calling
ReselectTarget
(typically using something likeMifareCard.ReselectCard
) on a card that is not in error state no longer puts the card in a non-responsive state.Pn532.ReselectTarget
already usesWUPA
., andPn5180.ReselectTarget
is not implemented for Type A.Microsoft Reviewers: Open in CodeFlow