Skip to content
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

FeliCa: check for 212 kbit tag if no 424 kbit tags are found #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions libfreefare/freefare.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,21 @@ freefare_get_tags(nfc_device *device)
}
}

// Poll for a FELICA tag
// Poll for a FELICA 424 kbit tag
modulation.nmt = NMT_FELICA;
modulation.nbr = NBR_424; // FIXME NBR_212 should also be supported
if ((candidates_count = nfc_initiator_list_passive_targets(device, modulation, candidates, MAX_CANDIDATES)) < 0)
modulation.nbr = NBR_424;

candidates_count = nfc_initiator_list_passive_targets(device, modulation, candidates, MAX_CANDIDATES);
if (candidates_count < 0)
return NULL;

// Poll for a FELICA 212 kbit tag (only if no 424 kbit tag was found)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we list both 212 and 424 kbit tags instead of listing 212 tags when no 424 is found?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess one could... but does libfreefare support multiple readers? If not then it doesn't make too much sense to worry about that use case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it does: as far as I can recall, I ran the test suite with 2 devices and 1 or 2 cards on each. Has less communication problems than with 1 device and 3+ tags 😄

But sometimes my memory tricks on me, and I don't have this hardware anymore to check.

modulation.nbr = NBR_212;

if (!candidates_count)
candidates_count = nfc_initiator_list_passive_targets(device, modulation, candidates, MAX_CANDIDATES);

if (candidates_count < 0)
return NULL;

for (int c = 0; c < candidates_count; c++) {
Expand Down