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

[FL-3772] Felica poller #3570

Merged
merged 56 commits into from
Apr 10, 2024

Conversation

RebornedBrain
Copy link
Contributor

@RebornedBrain RebornedBrain commented Apr 4, 2024

What's new

  • Now poller is able to read data from felica card
  • Authentication process is also provided for those, who know the card key (CK) for their card

Verification

  • Choose 'Read' item in NFC app and apply felica card to flipper's back. Flipper will read card and show an amount of read blocks.
  • Why the amount of blocks is always less then total amount? That's because you need to know CK (card key) block and place it into 'Unlock' menu item, after that apply the card to flipper's back again.
  • Cards with protected blocks will behave as described above, but the amount of read blocks may differ. Steps to unlock such cards are the same. Read -> Unlock -> Input CK (if you know it) -> Apply card again.
  • On 'Info' screen there is some information about the card and on 'More' screen there is a dump with block names and status flags SF1 and SF2, which are individual for each block and describe whether read was successful or not.

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

…tions succeeded, otherwise decrement blocks count by 1
@skotopes
Copy link
Member

skotopes commented Apr 7, 2024

[Switching to Thread 537085752]
loader_start_external_app (loader=loader@entry=0x20007040, storage=storage@entry=0x20007a60, path=path@entry=0x80a2698 "/ext/apps/NFC/nfc.fap", args=args@entry=0x0, error_message=error_message@entry=0x2000d9f8)
    at applications/services/loader/loader.c:350
350	            __asm volatile("bkpt 0");
New application loaded. Adding debug info
Loading debug information from build/f7-firmware-D/.extapps/nfc_d.elf
add symbol table from file "build/f7-firmware-D/.extapps/nfc_d.elf" at
	.text_addr = 0x2000df84
	.data_addr = 0x20021074
	.rodata_addr = 0x2001d67c
(gdb) c
Continuing.
[New Thread 536925024]
[New Thread 536927552]

Thread 23 "NfcWorker" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 536925024]
0x08014fb8 in __furi_crash_implementation () at furi/core/check.c:163
163	        RESTORE_REGISTERS_AND_HALT_MCU(debug);
(gdb) bt
#0  0x08014fb8 in __furi_crash_implementation () at furi/core/check.c:163
#1  0x08048eda in felica_calculate_mac (ctx=ctx@entry=0x2000ce60, session_key=session_key@entry=0x2000cfe0 "\364\307\321W\365\032\374f\371\372?\adH&3", rc=rc@entry=0x2000d26a "\247\204\2405i\005]\243\2521\320\004\027?\223p", 
    first_block=first_block@entry=0x20024f88 "\202", data=data@entry=0x2000d04d "\001.Y&\317G_Z", length=length@entry=32, mac=mac@entry=0x20024f80 "\274O\002", <incomplete sequence \340\317>) at lib/nfc/protocols/felica/felica.c:233
#2  0x08048fb2 in felica_check_mac (ctx=ctx@entry=0x2000ce60, session_key=session_key@entry=0x2000cfe0 "\364\307\321W\365\032\374f\371\372?\adH&3", rc=0x2000d26a "\247\204\2405i\005]\243\2521\320\004\027?\223p", 
    blocks=blocks@entry=0x20024fc4 "\202\220\221\b", <incomplete sequence \314>, block_count=3 '\003', data=0x2000d04d "\001.Y&\317G_Z") at lib/nfc/protocols/felica/felica.c:295
#3  0x080493c4 in felica_poller_state_handler_auth_internal (instance=0x2000ce58) at lib/nfc/protocols/felica/felica_poller.c:124
#4  0x080491b4 in felica_poller_run (event=..., context=<optimized out>) at lib/nfc/protocols/felica/felica_poller.c:282
#5  0x0804719a in nfc_poller_start_callback (event=..., context=0x2000cc38) at lib/nfc/nfc_poller.c:111
#6  0x08045fba in nfc_worker_poller_ready_handler (instance=0x2000bb80) at lib/nfc/nfc.c:182
#7  0x0804606e in nfc_worker_poller (context=0x2000bb80) at lib/nfc/nfc.c:232
#8  0x0801796e in furi_thread_body (context=0x2000b200) at furi/core/thread.c:91
#9  0x0801791a in furi_thread_catch () at furi/core/thread.c:62
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

furi_assert failed on unlock

@skotopes
Copy link
Member

skotopes commented Apr 7, 2024

Compiled with LIB_DEBUG=1

skotopes
skotopes previously approved these changes Apr 9, 2024
skotopes
skotopes previously approved these changes Apr 9, 2024
skotopes
skotopes previously approved these changes Apr 10, 2024
@skotopes skotopes merged commit fb9728d into flipperdevices:dev Apr 10, 2024
11 checks passed
@RebornedBrain RebornedBrain deleted the reborned/felica_poller branch August 19, 2024 10:48
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.

2 participants