From f70d2b5ae7f1aa47e234450c9654c4aceb0fa1cc Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sat, 5 Aug 2023 14:25:16 +0300 Subject: [PATCH] revert old nfc debug defines was used to save space --- applications/main/nfc/scenes/nfc_scene_config.h | 4 ---- applications/main/nfc/scenes/nfc_scene_debug.c | 2 -- .../main/nfc/scenes/nfc_scene_emulate_apdu_sequence.c | 2 -- applications/main/nfc/scenes/nfc_scene_field.c | 2 -- applications/main/nfc/scenes/nfc_scene_start.c | 11 +++-------- lib/nfc/nfc_worker.c | 11 +++-------- lib/nfc/protocols/emv.c | 6 ++---- 7 files changed, 8 insertions(+), 30 deletions(-) diff --git a/applications/main/nfc/scenes/nfc_scene_config.h b/applications/main/nfc/scenes/nfc_scene_config.h index aea59957d..f11d14798 100644 --- a/applications/main/nfc/scenes/nfc_scene_config.h +++ b/applications/main/nfc/scenes/nfc_scene_config.h @@ -53,18 +53,14 @@ ADD_SCENE(nfc, mf_classic_update_success, MfClassicUpdateSuccess) ADD_SCENE(nfc, mf_classic_wrong_card, MfClassicWrongCard) ADD_SCENE(nfc, emv_read_success, EmvReadSuccess) ADD_SCENE(nfc, emv_menu, EmvMenu) -#if FURI_DEBUG ADD_SCENE(nfc, emulate_apdu_sequence, EmulateApduSequence) -#endif ADD_SCENE(nfc, device_info, DeviceInfo) ADD_SCENE(nfc, delete, Delete) ADD_SCENE(nfc, delete_success, DeleteSuccess) ADD_SCENE(nfc, restore_original_confirm, RestoreOriginalConfirm) ADD_SCENE(nfc, restore_original, RestoreOriginal) -#if FURI_DEBUG ADD_SCENE(nfc, debug, Debug) ADD_SCENE(nfc, field, Field) -#endif ADD_SCENE(nfc, dict_not_found, DictNotFound) ADD_SCENE(nfc, rpc, Rpc) ADD_SCENE(nfc, exit_confirm, ExitConfirm) diff --git a/applications/main/nfc/scenes/nfc_scene_debug.c b/applications/main/nfc/scenes/nfc_scene_debug.c index 5dc29c96a..ed079c2ed 100644 --- a/applications/main/nfc/scenes/nfc_scene_debug.c +++ b/applications/main/nfc/scenes/nfc_scene_debug.c @@ -1,4 +1,3 @@ -#if FURI_DEBUG #include "../nfc_i.h" enum SubmenuDebugIndex { @@ -53,4 +52,3 @@ void nfc_scene_debug_on_exit(void* context) { submenu_reset(nfc->submenu); } -#endif \ No newline at end of file diff --git a/applications/main/nfc/scenes/nfc_scene_emulate_apdu_sequence.c b/applications/main/nfc/scenes/nfc_scene_emulate_apdu_sequence.c index bc3f0f42d..358ad2ab6 100644 --- a/applications/main/nfc/scenes/nfc_scene_emulate_apdu_sequence.c +++ b/applications/main/nfc/scenes/nfc_scene_emulate_apdu_sequence.c @@ -1,4 +1,3 @@ -#if FURI_DEBUG #include "../nfc_i.h" #include @@ -33,4 +32,3 @@ void nfc_scene_emulate_apdu_sequence_on_exit(void* context) { nfc_blink_stop(nfc); } -#endif \ No newline at end of file diff --git a/applications/main/nfc/scenes/nfc_scene_field.c b/applications/main/nfc/scenes/nfc_scene_field.c index f287e8796..e3eb6a708 100644 --- a/applications/main/nfc/scenes/nfc_scene_field.c +++ b/applications/main/nfc/scenes/nfc_scene_field.c @@ -1,4 +1,3 @@ -#if FURI_DEBUG #include "../nfc_i.h" void nfc_scene_field_on_enter(void* context) { @@ -32,4 +31,3 @@ void nfc_scene_field_on_exit(void* context) { notification_internal_message(nfc->notifications, &sequence_reset_blue); popup_reset(nfc->popup); } -#endif \ No newline at end of file diff --git a/applications/main/nfc/scenes/nfc_scene_start.c b/applications/main/nfc/scenes/nfc_scene_start.c index 87a0427d3..c9e8bf78c 100644 --- a/applications/main/nfc/scenes/nfc_scene_start.c +++ b/applications/main/nfc/scenes/nfc_scene_start.c @@ -8,9 +8,7 @@ enum SubmenuIndex { SubmenuIndexSaved, SubmenuIndexExtraAction, SubmenuIndexAddManually, -#if FURI_DEBUG SubmenuIndexDebug, -#endif }; void nfc_scene_start_submenu_callback(void* context, uint32_t index) { @@ -31,12 +29,12 @@ void nfc_scene_start_on_enter(void* context) { submenu, "Extra Actions", SubmenuIndexExtraAction, nfc_scene_start_submenu_callback, nfc); submenu_add_item( submenu, "Add Manually", SubmenuIndexAddManually, nfc_scene_start_submenu_callback, nfc); -#if FURI_DEBUG + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { submenu_add_item( submenu, "Debug", SubmenuIndexDebug, nfc_scene_start_submenu_callback, nfc); } -#endif + submenu_set_selected_item( submenu, scene_manager_get_scene_state(nfc->scene_manager, NfcSceneStart)); @@ -84,14 +82,11 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) { nfc->scene_manager, NfcSceneStart, SubmenuIndexAddManually); scene_manager_next_scene(nfc->scene_manager, NfcSceneSetType); consumed = true; - } -#if FURI_DEBUG - else if(event.event == SubmenuIndexDebug) { + } else if(event.event == SubmenuIndexDebug) { scene_manager_set_scene_state(nfc->scene_manager, NfcSceneStart, SubmenuIndexDebug); scene_manager_next_scene(nfc->scene_manager, NfcSceneDebug); consumed = true; } -#endif } return consumed; } diff --git a/lib/nfc/nfc_worker.c b/lib/nfc/nfc_worker.c index 857b6ac82..77c95de34 100644 --- a/lib/nfc/nfc_worker.c +++ b/lib/nfc/nfc_worker.c @@ -95,13 +95,9 @@ int32_t nfc_worker_task(void* context) { } } else if(nfc_worker->state == NfcWorkerStateUidEmulate) { nfc_worker_emulate_uid(nfc_worker); - } -#if FURI_DEBUG - else if(nfc_worker->state == NfcWorkerStateEmulateApdu) { + } else if(nfc_worker->state == NfcWorkerStateEmulateApdu) { nfc_worker_emulate_apdu(nfc_worker); - } -#endif - else if(nfc_worker->state == NfcWorkerStateMfUltralightEmulate) { + } else if(nfc_worker->state == NfcWorkerStateMfUltralightEmulate) { nfc_worker_emulate_mf_ultralight(nfc_worker); } else if(nfc_worker->state == NfcWorkerStateMfClassicEmulate) { nfc_worker_emulate_mf_classic(nfc_worker); @@ -755,7 +751,7 @@ void nfc_worker_emulate_uid(NfcWorker* nfc_worker) { } } } -#if FURI_DEBUG + void nfc_worker_emulate_apdu(NfcWorker* nfc_worker) { FuriHalNfcTxRxContext tx_rx = {}; FuriHalNfcDevData params = { @@ -788,7 +784,6 @@ void nfc_worker_emulate_apdu(NfcWorker* nfc_worker) { reader_analyzer_stop(nfc_worker->reader_analyzer); } } -#endif void nfc_worker_mf_ultralight_auth_received_callback(MfUltralightAuth auth, void* context) { furi_assert(context); diff --git a/lib/nfc/protocols/emv.c b/lib/nfc/protocols/emv.c index 8cc5fc44e..4c4ac856b 100644 --- a/lib/nfc/protocols/emv.c +++ b/lib/nfc/protocols/emv.c @@ -44,7 +44,7 @@ const PDOLValue* const pdol_values[] = { &pdol_transaction_cert, &pdol_unpredict_number, }; -#if FURI_DEBUG + static const uint8_t select_ppse_ans[] = {0x6F, 0x29, 0x84, 0x0E, 0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31, 0xA5, 0x17, 0xBF, 0x0C, 0x14, 0x61, 0x12, 0x4F, 0x07, @@ -61,7 +61,7 @@ static const uint8_t pdol_ans[] = {0x77, 0x40, 0x82, 0x02, 0x20, 0x00, 0x57, 0x1 0x00, 0x9F, 0x26, 0x08, 0x7A, 0x65, 0x7F, 0xD3, 0x52, 0x96, 0xC9, 0x85, 0x9F, 0x27, 0x01, 0x00, 0x9F, 0x36, 0x02, 0x06, 0x0C, 0x9F, 0x6C, 0x02, 0x10, 0x00, 0x90, 0x00}; -#endif + static void emv_trace(FuriHalNfcTxRxContext* tx_rx, const char* message) { if(furi_log_get_level() == FuriLogLevelTrace) { FURI_LOG_T(TAG, "%s", message); @@ -409,7 +409,6 @@ bool emv_read_bank_card(FuriHalNfcTxRxContext* tx_rx, EmvApplication* emv_app) { return card_num_read; } -#if FURI_DEBUG bool emv_card_emulation(FuriHalNfcTxRxContext* tx_rx) { furi_assert(tx_rx); bool emulation_complete = false; @@ -443,4 +442,3 @@ bool emv_card_emulation(FuriHalNfcTxRxContext* tx_rx) { return emulation_complete; } -#endif \ No newline at end of file