Skip to content

[FL-3593] Picopass rework with new NFC API#62

Closed
gornekich wants to merge 36 commits intodevfrom
gornek/3593_picopass_rework
Closed

[FL-3593] Picopass rework with new NFC API#62
gornekich wants to merge 36 commits intodevfrom
gornek/3593_picopass_rework

Conversation

@gornekich
Copy link
Member

What's new

  • Rework Picopass App with new NFC API

Merge after flipperdevices/flipperzero-firmware#3050 is merged

Verification

  • Build SDK from NFC refactoring flipperzero-firmware#3050 : ./fbt updater_package
  • Update local path to SDK : ufbt update -t f7 -l <local-sdk-path>
  • Build and run Picopass App: ufbt launch
  • Verify app is working as before

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

@gornekich gornekich marked this pull request as draft October 20, 2023 20:24
@gornekich
Copy link
Member Author

gornekich commented Oct 20, 2023

Hello @bettse, @nvx !
I reworked Picopass with new NFC API. Since I don't have many picopass cards, I kindly ask you to test reworked app and make a code review. Please, let me know if you have any problems / questions

ADD_SCENE(picopass, emulate, Emulate)
ADD_SCENE(picopass, loclass, Loclass)
ADD_SCENE(picopass, key_input, KeyInput)
ADD_SCENE(picopass, dict_attack, DictAttack)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some of these seem like changes that at independent of the NFC refactor. If that is the case, could they be pulled out and done as an independent PR(s) so that it is easier to see the changed the refactor requires?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on this. It seems like it's a NFC refactor, plus major cleanup at the same time.

I'm also concerned that some of the decisions, especially around emulation splitting to looping over an array of handlers rather than a switch statement, will affect emulation speed breaking compatibility with some readers. There's definitely some code that doesn't look the clanest but was done that way for performance reasons to make it work. Rather difficult determine what has broken something when there's so many things done together.

Copy link
Member Author

@gornekich gornekich Oct 28, 2023

Choose a reason for hiding this comment

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

@nvx sorry for late response, lost your message.

I think that introduced array of handlers in emulation part doesn't affect flipper response time much but gives cleaner code. Meanwhile we improved ISO15693 signal decoder and encoder in NFC library, which helped us to achieve better timings. Still we need to test it, and if it doesn't work good, we can apply some optimizations.

SubmenuIndexWriteCustom,
};

typedef struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an example of code I like, but feels unrelated and could probably go in beforehand (or after, which ever is easier)

@skotopes
Copy link
Contributor

Splitting PR into 2:

  • RFAL_PICOPASS_x
  • dictionary? (check complexity)
  • Menu?

@pcunning
Copy link

I ran this through some testing

Reading seems to be working as expected, tested cards with

  • different bit lengths
  • SIO
  • SE
  • outside HID range

I had some issues initially saving files, not sure if that was missing directories (fresh SD card) but it eventually started working.

Emulation is working on SE (Rev E) and Signo readers. It is not working on Rev A or Rev C (multiclass non SE) while the older firmware is working. (I believe this has to do with iso15 vs iso14b @nvx would know better).

When running loclass on a standard keyed reader it should indicate std keyed however it is crashing (with the vibration running) and needs a hard reset. Loclass was working as expected on an elite keyed reader.

@gornekich
Copy link
Member Author

@bettse @nvx
I will split the PR into two parts as we discussed. The first part will be refactored "worker" part with new API and the second part will be application clean up. Coming later this week

@nvx
Copy link
Contributor

nvx commented Oct 23, 2023

Emulation is working on SE (Rev E) and Signo readers. It is not working on Rev A or Rev C (multiclass non SE) while the older firmware is working. (I believe this has to do with iso15 vs iso14b @nvx would know better).

They both do 15693, but the RevA though C readers use shallow modulation/10% modulation index ASK, while the rest you tested that worked use OOK modulation.

I haven't looked at the NFC refactor code yet, but if someone stopped using the IRQ pin and instead changed to MISO to read the incoming modulation from the card in the 15693 code that would explain the issue.

Otherwise it could be a timing issue as well, each firmware seems to have slightly different thresholds for timing go figure.

@bettse
Copy link
Collaborator

bettse commented Oct 24, 2023

In an attempt to be helpful I created a PR that renamed RFAL_PICOPASS_BLOCK_LEN to make this PR smaller: #63
If that sounds OK we can merge it, but if you'd prefer to handle it yourself we can just close it.

@bettse
Copy link
Collaborator

bettse commented Oct 25, 2023

Want me to fix the conflicting files (since they are pretty much my fault)?

@gornekich
Copy link
Member Author

gornekich commented Oct 25, 2023

Want me to fix the conflicting files (since they are pretty much my fault)?

No, thanks!
I will close this PR once I make another one with smaller changes. I leave this PR opened for a few days in case someone wants to test picopass on new NFC stack. We already fixed one issue in NFC library after testing this PR.

@skotopes
Copy link
Contributor

Hello everyone, FW is almost ready: there will be one more tests iteration by QA team on Monday and then it will be released.

@gornekich
Copy link
Member Author

gornekich commented Oct 28, 2023

As we agreed, I made another PR with smaller changes, which works with new NFC stack. Let's continue conversation there #68

@gornekich gornekich closed this Oct 28, 2023
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.

6 participants