Просмотр исходного кода

Merge nfc_magic from https://github.com/xMasterX/all-the-plugins

Willy-JL 2 лет назад
Родитель
Сommit
9068b74701

+ 1 - 0
nfc_magic/lib/magic/protocols/gen4/gen4_poller.c

@@ -194,6 +194,7 @@ NfcCommand gen4_poller_wipe_handler(Gen4Poller* instance) {
                 instance->state = Gen4PollerStateFail;
                 instance->state = Gen4PollerStateFail;
                 break;
                 break;
             }
             }
+            instance->password = 0;
             error = gen4_poller_write_block(
             error = gen4_poller_write_block(
                 instance, instance->password, instance->current_block, gen4_poller_default_block_0);
                 instance, instance->password, instance->current_block, gen4_poller_default_block_0);
             if(error != Gen4PollerErrorNone) {
             if(error != Gen4PollerErrorNone) {

+ 2 - 0
nfc_magic/scenes/nfc_magic_scene_change_key.c

@@ -59,6 +59,7 @@ void nfc_magic_scene_change_key_on_enter(void* context) {
     nfc_magic_app_blink_start(instance);
     nfc_magic_app_blink_start(instance);
 
 
     instance->gen4_poller = gen4_poller_alloc(instance->nfc);
     instance->gen4_poller = gen4_poller_alloc(instance->nfc);
+    gen4_poller_set_password(instance->gen4_poller, instance->gen4_password);
     gen4_poller_start(
     gen4_poller_start(
         instance->gen4_poller, nfc_mafic_scene_change_key_gen4_poller_callback, instance);
         instance->gen4_poller, nfc_mafic_scene_change_key_gen4_poller_callback, instance);
 }
 }
@@ -83,6 +84,7 @@ bool nfc_magic_scene_change_key_on_event(void* context, SceneManagerEvent event)
             nfc_magic_scene_change_key_setup_view(instance);
             nfc_magic_scene_change_key_setup_view(instance);
             consumed = true;
             consumed = true;
         } else if(event.event == NfcMagicCustomEventWorkerSuccess) {
         } else if(event.event == NfcMagicCustomEventWorkerSuccess) {
+            instance->gen4_password = instance->gen4_password_new;
             scene_manager_next_scene(instance->scene_manager, NfcMagicSceneSuccess);
             scene_manager_next_scene(instance->scene_manager, NfcMagicSceneSuccess);
             consumed = true;
             consumed = true;
         } else if(event.event == NfcMagicCustomEventWorkerFail) {
         } else if(event.event == NfcMagicCustomEventWorkerFail) {

+ 1 - 0
nfc_magic/scenes/nfc_magic_scene_check.c

@@ -24,6 +24,7 @@ void nfc_magic_scene_check_on_enter(void* context) {
     nfc_magic_app_blink_start(instance);
     nfc_magic_app_blink_start(instance);
 
 
     nfc_magic_scanner_start(instance->scanner, nfc_magic_check_worker_callback, instance);
     nfc_magic_scanner_start(instance->scanner, nfc_magic_check_worker_callback, instance);
+    nfc_magic_scanner_set_gen4_password(instance->scanner, instance->gen4_password);
 
 
     view_dispatcher_switch_to_view(instance->view_dispatcher, NfcMagicAppViewPopup);
     view_dispatcher_switch_to_view(instance->view_dispatcher, NfcMagicAppViewPopup);
 }
 }

+ 1 - 1
nfc_magic/scenes/nfc_magic_scene_not_magic.c

@@ -16,7 +16,7 @@ void nfc_magic_scene_not_magic_on_enter(void* context) {
     widget_add_string_element(
     widget_add_string_element(
         widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "This is wrong card");
         widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "This is wrong card");
     widget_add_string_multiline_element(
     widget_add_string_multiline_element(
-        widget, 4, 17, AlignLeft, AlignTop, FontSecondary, "Not magic or unsupported\ncard");
+        widget, 4, 17, AlignLeft, AlignTop, FontSecondary, "Not magic or unsupported\ncard. Only Gen1 and\nGen4 UMC cards supported.");
     widget_add_button_element(
     widget_add_button_element(
         widget, GuiButtonTypeLeft, "Retry", nfc_magic_scene_not_magic_widget_callback, instance);
         widget, GuiButtonTypeLeft, "Retry", nfc_magic_scene_not_magic_widget_callback, instance);
 
 

+ 1 - 0
nfc_magic/scenes/nfc_magic_scene_write.c

@@ -93,6 +93,7 @@ void nfc_magic_scene_write_on_enter(void* context) {
             instance->gen1a_poller, nfc_mafic_scene_write_gen1_poller_callback, instance);
             instance->gen1a_poller, nfc_mafic_scene_write_gen1_poller_callback, instance);
     } else {
     } else {
         instance->gen4_poller = gen4_poller_alloc(instance->nfc);
         instance->gen4_poller = gen4_poller_alloc(instance->nfc);
+        gen4_poller_set_password(instance->gen4_poller, instance->gen4_password);
         gen4_poller_start(
         gen4_poller_start(
             instance->gen4_poller, nfc_mafic_scene_write_gen4_poller_callback, instance);
             instance->gen4_poller, nfc_mafic_scene_write_gen4_poller_callback, instance);
     }
     }