Skip to content

[codex] Fix transit card balance readers#10

Merged
Lakr233 merged 10 commits into
mainfrom
codex/fix-transit-card-balances
May 8, 2026
Merged

[codex] Fix transit card balance readers#10
Lakr233 merged 10 commits into
mainfrom
codex/fix-transit-card-balances

Conversation

@Lakr233

@Lakr233 Lakr233 commented May 8, 2026

Copy link
Copy Markdown
Owner

What changed

  • Updates Octopus balance offsets to follow the public 2017 schedule: 350 before 2017-10-01, 500 afterward.
  • Masks the high spare bit in T-Union balance responses and keeps the dual-purse display behavior aligned with Metrodroid.
  • Makes KSX6924 AID probing continue after recoverable SELECT status errors.
  • Adds TWD balance formatting for EasyCard parsing work and aligns Japan IC balance offset references.
  • Expands transit-card research notes with Metrodroid and FareBot references, including EasyCard Classic dump layout.

Validation

  • swiftformat --swift-version 6.2 on changed Swift files
  • npx --yes prettier --write docs/Transit-Card-Research.md
  • git diff --check
  • xcodebuild test -scheme CoreExtendedNFC -destination "platform=iOS Simulator,id=EEC22792-5938-4D4B-81EC-610FEA2ED56B"
  • xcodebuild -project Example/CENFC.xcodeproj -scheme CENFC -destination "generic/platform=iOS Simulator" build

Notes

Classic EasyCard remains a decrypted-dump parsing target on iOS. The new TWD formatting and documented layout prepare the parser work without adding a live MIFARE Classic authentication path.

Lakr233 added 10 commits May 9, 2026 00:44
Compute T-Union balance as primary minus negative purse and add robust file-info parsing and metadata. Added file15SFIReadP1 constant and a READ BINARY-by-SFI fallback (p1=0x95) when SELECT 0015 fails; introduced parseFileInfo and readFileInfoFromSFI helpers and record file-info source. TransitBalance now carries reader-specific metadata. Updated display logic to always use primary - negative, and updated TUnionReader to include metadata about balance sources and file info. Tests expanded/added for T-Union, JapanIC and Octopus (with logged-transport helpers and hex utilities). Documentation updated with Shanghai app findings and the new SFI fallback and purse-delta behavior.
@Lakr233 Lakr233 marked this pull request as ready for review May 8, 2026 16:56
@Lakr233 Lakr233 merged commit b4489e8 into main May 8, 2026
4 checks passed
@Lakr233 Lakr233 deleted the codex/fix-transit-card-balances branch May 8, 2026 16:56
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