From bdfe7ad9704250047a7f85f82b3666856552e797 Mon Sep 17 00:00:00 2001 From: gornekich Date: Thu, 23 May 2024 11:08:55 +0100 Subject: [PATCH 1/2] nfc app: fix changing uid on each byte change --- applications/main/nfc/scenes/nfc_scene_set_uid.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/applications/main/nfc/scenes/nfc_scene_set_uid.c b/applications/main/nfc/scenes/nfc_scene_set_uid.c index f09d0a43033..4b4bbb1931c 100644 --- a/applications/main/nfc/scenes/nfc_scene_set_uid.c +++ b/applications/main/nfc/scenes/nfc_scene_set_uid.c @@ -2,13 +2,6 @@ #include "../helpers/protocol_support/nfc_protocol_support_gui_common.h" -static void nfc_scene_set_uid_byte_input_changed_callback(void* context) { - NfcApp* instance = context; - // Retrieve previously saved UID length - const size_t uid_len = scene_manager_get_scene_state(instance->scene_manager, NfcSceneSetUid); - nfc_device_set_uid(instance->nfc_device, instance->byte_input_store, uid_len); -} - void nfc_scene_set_uid_on_enter(void* context) { NfcApp* instance = context; @@ -25,7 +18,7 @@ void nfc_scene_set_uid_on_enter(void* context) { byte_input_set_result_callback( byte_input, nfc_protocol_support_common_byte_input_done_callback, - nfc_scene_set_uid_byte_input_changed_callback, + NULL, instance, instance->byte_input_store, uid_len); @@ -39,6 +32,9 @@ bool nfc_scene_set_uid_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == NfcCustomEventByteInputDone) { + size_t uid_len = 0; + nfc_device_get_uid(instance->nfc_device, &uid_len); + nfc_device_set_uid(instance->nfc_device, instance->byte_input_store, uid_len); if(scene_manager_has_previous_scene(instance->scene_manager, NfcSceneSavedMenu)) { if(nfc_save(instance)) { scene_manager_next_scene(instance->scene_manager, NfcSceneSaveSuccess); From 63d9741c9548fb06a5d4dc43b8bbbbd570345678 Mon Sep 17 00:00:00 2001 From: gornekich Date: Thu, 23 May 2024 11:14:12 +0100 Subject: [PATCH 2/2] nfc app: remove unused code --- applications/main/nfc/scenes/nfc_scene_set_uid.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/applications/main/nfc/scenes/nfc_scene_set_uid.c b/applications/main/nfc/scenes/nfc_scene_set_uid.c index 4b4bbb1931c..f702fa05b3b 100644 --- a/applications/main/nfc/scenes/nfc_scene_set_uid.c +++ b/applications/main/nfc/scenes/nfc_scene_set_uid.c @@ -7,10 +7,7 @@ void nfc_scene_set_uid_on_enter(void* context) { size_t uid_len; const uint8_t* uid = nfc_device_get_uid(instance->nfc_device, &uid_len); - memcpy(instance->byte_input_store, uid, uid_len); - // Save UID length for use in callback - scene_manager_set_scene_state(instance->scene_manager, NfcSceneSetUid, uid_len); // Setup view ByteInput* byte_input = instance->byte_input;