-
Notifications
You must be signed in to change notification settings - Fork 62
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 Magic: New functions for Gen4 cards (DW to block 0/shadow mode) #98
Conversation
@Leptopt1los what will be the difference between set standard config and wipe? |
set standart config does not change the data on the card, but only the config. wipe can work out with an error for 06A0, and even be the cause of her "coma" itself. using set stabdart config you do not lose the current data on the card if I understood you correctly, are you thinking about deleting the set default config item and transferring wipe from gen4_menu to gen4_actions? this probably made the code cleaner to some extent, but I can't say with full confidence that the wipe function can fully replace the set default config function first, this scenario needs to be tested - will wipe be able to revive 06A0 in a coma (since in its normal state, wipe fails for it at the stage of writing standard data if the card lies exactly under the flipper) |
…set default config
Okay, I'll discuss it with NFC team and then merge. |
@Leptopt1los config read is not working for me. My revision 06 A0. Both cards I got behave that way. |
@gornekich can you take a look on this PR? |
Hi @Leptopt1los Regarding this PR, we need to fix navigation between the scenes. After successful action in gen4 menu we should return back to gen4 menu, not to the start screen. After it's fixed, me can merge the PR. Please, let me know your thoughts about the design. Also, are you interested in implemented it? If not, we will do it ourselves. |
hi @gornekich! questions:
this is how it will work according to the user flow from figma To prevent this from happening, I added a GetInfo scene before Info, which again accesses the map. Will this solution suit us? |
@Leptopt1los I think it's time to make a separate class Gen4, which will hold just gen4 related data. It includes configuration, revision and parsed configuration data. I suggest making Gen4 fields public just to avoid writing too many getters/setters. The interface for this class could be something like this:
It would be nice to rework gen4_poller_get_config() and gen4_poller_get_revision() functions to work with Gen4Revision and Gen4Config types. Making new type for a data structure is zero cost operation, but it makes code more readable and helps you to avoid mistakes in future. Further, Gen4Poller instance should allocate Gen4 instance and keep it up to date. I think the best option to achieve that is to make "mandatory" state for each poller mode which will read gen4 config and store it in Gen4 instance inside poller instance. I can see that you already added gen4_poller_get_current_cfg_handler(), I suggest to call it after RequestMode state. Each time we want to change config in poller, we should follow these steps:
After that's done, Gen4Poller interface should have function: Now answering your questions:
|
@gornekich can you take a look please? |
I also have several identical scenes that perform a similar action: nfc_magic_scene_gen4_set_default_cfg, nfc_magic_scene_gen4_set_direct_write_block_0_mode, nfc_magic_scene_gen4_set_shd_mode, nfc_magic_scene_gen4_get_info. Should I combine these scenes into one and select the desired action based on the state of the scene? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good progress, thank you for working on that!
What do you think about jumping to Gen4PollerStateGetInfo state always before Gen4PollerStateSuccess state? I mean we can update internal Gen4 data right before poller finishes its work for all modes.
#include "core/check.h" | ||
|
||
Gen4* gen4_alloc() { | ||
Gen4* instance = (Gen4*)malloc(sizeof(Gen4)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to cast (Gen4*) explicitly
//TODO: INCAPSULATE? | ||
#include "gui/scene_manager.h" | ||
#include "protocols/gen4/gen4_poller_i.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"scene_manager.h" is already included in #include "../nfc_magic_app_i.h"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't include private API. There should be function in gen4_poller.h
const Gen4* gen4_poller_get_data(Gen4Poller* instance);
Well done, thanks a lot! |
What's new
Verification
Shadow mode verification
Direct write to block 0 verification
Back button event handlers verification
Cleanup verification
Checklist (For Reviewer)