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

NFC: FeliCa Protocol Expose Read Block API and Allow Specifying Service #4074

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

zinongli
Copy link
Contributor

@zinongli zinongli commented Jan 20, 2025

What's new

  • A brief background for the jargons: one FeliCa tag hosts multiple Systems, each System hosts multiple Services, each Service has its own Blocks. I'll skip Area here as it's not relevant. Currently, FeliCa protocol is implemented in this way (as far as I can tell from reading lib/nfc/protocol/felica/): always select the first system on the list, always request service FELICA_SERVICE_RO_ACCESS, and always read these few blocks.
  • To be fair, one could definitely use the internal functions in felica_poller_i.c to read all sorts of things. For example, for Suica, one could read travel history and tap logs by reading the blocks from their corresponding services, by inputing the corresponding service code to felica_poller_prepare_tx_buffer(). The only problem is, it's internal, so not available to external apps.
  • This situation forbids the full potential of the FeliCa reading utility Flipper has. In this PR I exposed the read_block function and allowed service code selection mainly for the reason that I'm trying to implement a Suica parser using FeliCa poller. Because I intend to do that in an external app (Metroflip), exposing the API is the only way as of now.
  • Also, I left the native NFC app as it is. Only moving the macro outside of read_block() into where read_block() is used by felica poller.
  • Lastly, the current FeliCa workflow of the native NFC app could be improved by allowing users to manually input the service code they are looking for and iterate through all blocks until either status flag reaches non-zero. This PR's change could allow that to happen. But whether it is a good thing to have is a topic for another PR.

Verification

  • I currently have a working version of Metroflip that can read raw Suica travel history and tap logs by requesting the correct service codes. You can build that app with this PR's firmware and read a Suica card. It should show a reading like this:
    Screenshot-20250119-190813

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

@zinongli
Copy link
Contributor Author

  • Lastly, the current FeliCa workflow of the native NFC app could be improved by allowing users to manually input the service code they are looking for and iterate through all blocks until either status flag reaches non-zero. This PR's change could allow that to happen. But whether it is a good thing to have is a topic for another PR.

Just to add a bit more context, a lot of FeliCa cards have well documented service codes useful for user to select and to read the data in their cards. Allowing user or apps to request the service they need would be a nice thing to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant