From c40e8811d68e9f4b8f603ae5d5826b814521014d Mon Sep 17 00:00:00 2001 From: gornekich Date: Thu, 28 Jul 2022 15:34:28 +0300 Subject: [PATCH] [FL-2701], [FL-2702], [FL-2699] NFC fixes (#1478) * nfc: change read scene views * nfc: rework return after save success * nfc: add fallback to read UID of unrecognized iso14443-3 * nfc: show mifare desfire on read success * nfc: add restore original confirm scene * nfc: fix icon name * nfc: clear 6 bit in SAK to emulate 14443-4 uids * nfc: don't change original sak --- applications/nfc/scenes/nfc_scene_config.h | 1 + .../nfc_scene_mf_desfire_read_success.c | 14 ++--- applications/nfc/scenes/nfc_scene_read.c | 9 ++- .../nfc/scenes/nfc_scene_restore_original.c | 8 ++- .../nfc_scene_restore_original_confirm.c | 53 ++++++++++++++++++ .../nfc/scenes/nfc_scene_save_success.c | 8 +-- .../nfc/scenes/nfc_scene_saved_menu.c | 23 +++----- assets/icons/NFC/NFC_manual.png | Bin 3785 -> 3804 bytes assets/icons/NFC/Restoring.png | Bin 0 -> 3794 bytes furi/core/common_defines.h | 4 ++ lib/nfc/nfc_worker.c | 11 +++- 11 files changed, 98 insertions(+), 33 deletions(-) create mode 100644 applications/nfc/scenes/nfc_scene_restore_original_confirm.c create mode 100644 assets/icons/NFC/Restoring.png diff --git a/applications/nfc/scenes/nfc_scene_config.h b/applications/nfc/scenes/nfc_scene_config.h index 6e2369fd..de8de6b4 100755 --- a/applications/nfc/scenes/nfc_scene_config.h +++ b/applications/nfc/scenes/nfc_scene_config.h @@ -30,6 +30,7 @@ ADD_SCENE(nfc, emulate_apdu_sequence, EmulateApduSequence) 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) ADD_SCENE(nfc, debug, Debug) ADD_SCENE(nfc, field, Field) diff --git a/applications/nfc/scenes/nfc_scene_mf_desfire_read_success.c b/applications/nfc/scenes/nfc_scene_mf_desfire_read_success.c index 673b316b..a04f4e55 100644 --- a/applications/nfc/scenes/nfc_scene_mf_desfire_read_success.c +++ b/applications/nfc/scenes/nfc_scene_mf_desfire_read_success.c @@ -34,18 +34,12 @@ void nfc_scene_mf_desfire_read_success_on_enter(void* context) { } } + // TODO rework info view nfc_text_store_set( nfc, - "UID: %02X %02X %02X %02X %02X %02X %02X\n" NFC_SCENE_READ_SUCCESS_SHIFT - "%d%s bytes\n" NFC_SCENE_READ_SUCCESS_SHIFT "%d bytes free\n" - "%d application%s, %d file%s", - data->version.uid[0], - data->version.uid[1], - data->version.uid[2], - data->version.uid[3], - data->version.uid[4], - data->version.uid[5], - data->version.uid[6], + NFC_SCENE_READ_SUCCESS_SHIFT "Mifare DESFire\n" NFC_SCENE_READ_SUCCESS_SHIFT + "%d%s bytes\n" NFC_SCENE_READ_SUCCESS_SHIFT "%d bytes free\n" + "%d application%s, %d file%s", 1 << (data->version.sw_storage >> 1), (data->version.sw_storage & 1) ? "+" : "", data->free_memory ? data->free_memory->bytes : 0, diff --git a/applications/nfc/scenes/nfc_scene_read.c b/applications/nfc/scenes/nfc_scene_read.c index 9e1c0109..491b419e 100644 --- a/applications/nfc/scenes/nfc_scene_read.c +++ b/applications/nfc/scenes/nfc_scene_read.c @@ -23,12 +23,15 @@ void nfc_scene_read_set_state(Nfc* nfc, NfcSceneReadState state) { uint32_t curr_state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneRead); if(curr_state != state) { if(state == NfcSceneReadStateDetecting) { - popup_set_header(nfc->popup, "Detecting\nNFC card", 90, 24, AlignCenter, AlignTop); - popup_set_icon(nfc->popup, 5, 7, &I_NFC_manual); + popup_reset(nfc->popup); + popup_set_text( + nfc->popup, "Apply card to\nFlipper's back", 97, 24, AlignCenter, AlignTop); + popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual); } else if(state == NfcSceneReadStateReading) { + popup_reset(nfc->popup); popup_set_header( nfc->popup, "Reading card\nDon't move...", 85, 24, AlignCenter, AlignTop); - popup_set_icon(nfc->popup, 19, 23, &A_Loading_24); + popup_set_icon(nfc->popup, 12, 23, &A_Loading_24); } scene_manager_set_scene_state(nfc->scene_manager, NfcSceneRead, state); } diff --git a/applications/nfc/scenes/nfc_scene_restore_original.c b/applications/nfc/scenes/nfc_scene_restore_original.c index 40b59b9e..3ecf5c04 100644 --- a/applications/nfc/scenes/nfc_scene_restore_original.c +++ b/applications/nfc/scenes/nfc_scene_restore_original.c @@ -25,7 +25,13 @@ bool nfc_scene_restore_original_on_event(void* context, SceneManagerEvent event) if(event.type == SceneManagerEventTypeCustom) { if(event.event == NfcCustomEventViewExit) { - consumed = scene_manager_previous_scene(nfc->scene_manager); + if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSavedMenu)) { + consumed = scene_manager_search_and_switch_to_previous_scene( + nfc->scene_manager, NfcSceneSavedMenu); + } else { + consumed = scene_manager_search_and_switch_to_previous_scene( + nfc->scene_manager, NfcSceneStart); + } } } return consumed; diff --git a/applications/nfc/scenes/nfc_scene_restore_original_confirm.c b/applications/nfc/scenes/nfc_scene_restore_original_confirm.c new file mode 100644 index 00000000..70d161dd --- /dev/null +++ b/applications/nfc/scenes/nfc_scene_restore_original_confirm.c @@ -0,0 +1,53 @@ +#include "../nfc_i.h" + +void nfc_scene_restore_original_confirm_dialog_callback(DialogExResult result, void* context) { + Nfc* nfc = context; + + view_dispatcher_send_custom_event(nfc->view_dispatcher, result); +} + +void nfc_scene_restore_original_confirm_on_enter(void* context) { + Nfc* nfc = context; + DialogEx* dialog_ex = nfc->dialog_ex; + + dialog_ex_set_header(dialog_ex, "Restore card data?", 64, 0, AlignCenter, AlignTop); + dialog_ex_set_icon(dialog_ex, 5, 15, &I_Restoring); + dialog_ex_set_text( + dialog_ex, "It will be returned\nto its original state.", 47, 21, AlignLeft, AlignTop); + dialog_ex_set_left_button_text(dialog_ex, "Cancel"); + dialog_ex_set_right_button_text(dialog_ex, "Restore"); + dialog_ex_set_context(dialog_ex, nfc); + dialog_ex_set_result_callback(dialog_ex, nfc_scene_restore_original_confirm_dialog_callback); + + view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewDialogEx); +} + +bool nfc_scene_restore_original_confirm_on_event(void* context, SceneManagerEvent event) { + Nfc* nfc = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == DialogExResultRight) { + if(!nfc_device_restore(nfc->dev, true)) { + scene_manager_search_and_switch_to_previous_scene( + nfc->scene_manager, NfcSceneStart); + } else { + scene_manager_next_scene(nfc->scene_manager, NfcSceneRestoreOriginal); + } + consumed = true; + } else if(event.event == DialogExResultLeft) { + consumed = scene_manager_previous_scene(nfc->scene_manager); + } + } else if(event.type == SceneManagerEventTypeBack) { + consumed = true; + } + + return consumed; +} + +void nfc_scene_restore_original_confirm_on_exit(void* context) { + Nfc* nfc = context; + + // Clean view + dialog_ex_reset(nfc->dialog_ex); +} diff --git a/applications/nfc/scenes/nfc_scene_save_success.c b/applications/nfc/scenes/nfc_scene_save_success.c index 355f4a80..a3b17451 100644 --- a/applications/nfc/scenes/nfc_scene_save_success.c +++ b/applications/nfc/scenes/nfc_scene_save_success.c @@ -27,12 +27,12 @@ bool nfc_scene_save_success_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == NfcCustomEventViewExit) { - if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneMfDesfireMenu)) { + if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSavedMenu)) { consumed = scene_manager_search_and_switch_to_previous_scene( - nfc->scene_manager, NfcSceneMfDesfireMenu); + nfc->scene_manager, NfcSceneSavedMenu); } else { - consumed = scene_manager_search_and_switch_to_previous_scene( - nfc->scene_manager, NfcSceneStart); + consumed = scene_manager_search_and_switch_to_another_scene( + nfc->scene_manager, NfcSceneFileSelect); } } } diff --git a/applications/nfc/scenes/nfc_scene_saved_menu.c b/applications/nfc/scenes/nfc_scene_saved_menu.c index 269864ca..7c390f0b 100644 --- a/applications/nfc/scenes/nfc_scene_saved_menu.c +++ b/applications/nfc/scenes/nfc_scene_saved_menu.c @@ -2,7 +2,7 @@ enum SubmenuIndex { SubmenuIndexEmulate, - SubmenuIndexEdit, + SubmenuIndexRename, SubmenuIndexDelete, SubmenuIndexInfo, SubmenuIndexRestoreOriginal, @@ -33,10 +33,6 @@ void nfc_scene_saved_menu_on_enter(void* context) { submenu_add_item( submenu, "Emulate", SubmenuIndexEmulate, nfc_scene_saved_menu_submenu_callback, nfc); } - submenu_add_item( - submenu, "Edit UID and Name", SubmenuIndexEdit, nfc_scene_saved_menu_submenu_callback, nfc); - submenu_add_item( - submenu, "Delete", SubmenuIndexDelete, nfc_scene_saved_menu_submenu_callback, nfc); submenu_add_item( submenu, "Info", SubmenuIndexInfo, nfc_scene_saved_menu_submenu_callback, nfc); submenu_set_selected_item( @@ -44,11 +40,15 @@ void nfc_scene_saved_menu_on_enter(void* context) { if(nfc->dev->shadow_file_exist) { submenu_add_item( submenu, - "Restore original", + "Restore to original", SubmenuIndexRestoreOriginal, nfc_scene_saved_menu_submenu_callback, nfc); } + submenu_add_item( + submenu, "Rename", SubmenuIndexRename, nfc_scene_saved_menu_submenu_callback, nfc); + submenu_add_item( + submenu, "Delete", SubmenuIndexDelete, nfc_scene_saved_menu_submenu_callback, nfc); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu); } @@ -68,8 +68,8 @@ bool nfc_scene_saved_menu_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(nfc->scene_manager, NfcSceneEmulateUid); } consumed = true; - } else if(event.event == SubmenuIndexEdit) { - scene_manager_next_scene(nfc->scene_manager, NfcSceneSetUid); + } else if(event.event == SubmenuIndexRename) { + scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName); consumed = true; } else if(event.event == SubmenuIndexDelete) { scene_manager_next_scene(nfc->scene_manager, NfcSceneDelete); @@ -78,12 +78,7 @@ bool nfc_scene_saved_menu_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(nfc->scene_manager, NfcSceneDeviceInfo); consumed = true; } else if(event.event == SubmenuIndexRestoreOriginal) { - if(!nfc_device_restore(nfc->dev, true)) { - scene_manager_search_and_switch_to_previous_scene( - nfc->scene_manager, NfcSceneStart); - } else { - scene_manager_next_scene(nfc->scene_manager, NfcSceneRestoreOriginal); - } + scene_manager_next_scene(nfc->scene_manager, NfcSceneRestoreOriginalConfirm); consumed = true; } } diff --git a/assets/icons/NFC/NFC_manual.png b/assets/icons/NFC/NFC_manual.png index d142f0fcf6c043f990efad9cfa7eca1417499b2f..787c0bcfe01755f4dcadcdce004a1a0fcfb06f41 100644 GIT binary patch delta 3207 zcmZ`*X*ARi7ygOtdzNfv3khSajomEvC5((H`-~;KvSr4;M;g0EB>Pg4(O9x(4I%rM zEg}4~G|KjR&w1aE|8wrW&;9T`_nhbXbo&J61aJv=Omvy(dFcTFVA9uvn_r;XMa$7r zUQA^PJy`&tN4UXYcl2Q}K_5SFwA(`$00^2PSYVJA8(iw-g#)Nze0aK{w>c-RpgA-t zoFh$4QizV#AYQ0&n$xVE4S}HI>n(_*tR*pEA23N7-O zXeNIjJgcA7Sg+bA)D6?L(K2T0$(t#LGnPZIv3-l`>FQoumC=fz7xe*HY3rPY{7*$F zfFrD$+AZNWnvVcQ&=>&ol0C%KufW0{G`xp>TILZm70Bq8QI4KI!0KqFR@o>OZ6{s4%n}`5V zvH%C#unPiANdvO_R%kuoZ3ECY#L7?$&@uwDX7MpM0jf~IzE?yf2#C%BICS=`)PCKn zVO^KJ$SS8+jU);|MA*BB!*wG;B; zw~x4G(FnQw5xP`I-#R`Y7!~smKc|a!oco@td(yygej+d?+@J0n6dk&z;l!L z<%)$9pwDl9x-ok0yu2uNOsTP`2)uRIpa@NqF1znU`P)#O6&297Oa_3xChzvI610@z zu2D02h@(_T%a_duRawUJxPqR-5mj{i;+OHGli%xpsyV zd!=ZoXjcc66-w_M&hKY`vnmoQ5j*%+K++!cR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X_Xn%{moNh_%%Yb+~@%9eFCi%xoKuV;_5-?slovKYCsthDSq;()ah zbI9Y$gXK}*RaWO!w}s~UP72Nlrk)!-w{7D$rna)b!m*OOa$;3y2aVs6+wtA$7wP}t($~J z)tjL=9dGVYBrMVlg>HaO?4KW5rW5QD@cR;8cR3LO+Y!}iakB}HSmGS`J51QnQ@h@i}mU`ZS z5~s|uiDXGHksL51TJYR?^%p9?t?O)p?*!A8Mo4pxd!Ce(^;F{H_ZP>#-vx$xlDx4< zEM_H-97}#dz8jwK*K|FbKUm-_`|88Fw$V1-hqFP0Z;G2Y)gQ&s)Mhau9ne&V!lD8N-F3#?z4Y0NTNQ-`*YtJ2 z=1kymbi{s+kF&Ki#nZUIP#+xp2T|`r@7nyinCiUN7_cQncN>?hzf!GRqiY@$a4-#j z>EyrcPN%LqT&fA)y1IOEfHs8R^==ss`u6vmit{rZh4y(xtlm%l#~HF*!}j0MomFrc z#~;Lmb3|(R%l)RYgWo52d4J>U4r|?8e5de#U0YoHKRNQ!c-RvP4>OL25~c^ud(4Mr z&192P3nV4QxJ4-&xBAkjD_&O!^moVDAK{jRsum{?X7;Z1qxMJFI2lR(%{4gUW+1JK z_!8D3+acN5htpjz->>c)kEW4n4U-)d$sC1!gF~y$fn7{T#TQGu-eT0@zAF9xCfi=D zj@+sAK#qC^b!7|$0+G6)qXN~^a(BZ(-87Y?)FJBXst~9uL`NB-4O550pwKtgoU%+z zn&}~23Q}574O6WPCdU>GHC9tIH8F&mX`319KunFGYNi*=)Y2(jXa0q>{}WoH z{|Q-e|9_I!e?sxxMtFCZnux(jITZt%sV&evFw3_l}@7cn7NMs1Ew*3V(|F! QihzabiEAb`My~h%2Me9y#Q*>R diff --git a/assets/icons/NFC/Restoring.png b/assets/icons/NFC/Restoring.png new file mode 100644 index 0000000000000000000000000000000000000000..9e058869f103361416a78a8a8ba614fe12cbfbb5 GIT binary patch literal 3794 zcmaJ@c|25m|34!8R#`&2W62gXW^BzcwwbXnVPw!^Foqa2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=AV_oIpUHX5e z5DkN)S&?06K6okt&~YX^5hIR6HcY-^M zYiWWsd=Yd45`l&X`I0<5y%D}h@xOQxbos~(5eNO{LUTuo|0gM&=|vEVOeKKSz)%Gz zMMXuB8XQb;#={(yT<}ivAebTy3W3sZH3g^|0;Yt3!a;vu;`D%2XBUJeTJP_0bPXx) zN~2K_5QvYD57RJWT1XFV#J1p2FLgxfE3!RY;x z?{BR0uX9oSB^E+Y268mp|1;~KCi(&$iT^AwUHNDI37+(wr_z`Ew~Fsd^bdpWq6rpr zcz8$`>1W`2oH<=$q*Tsm~M%Mh)D^&N|OXu-`S#)@)Vzw_Dlc%^zw!%*SOjtlidA)dev_data->protocol = NfcDeviceProtocolUnknown; } card_read = true; + } else { + nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown; + card_read = true; } return card_read; @@ -321,8 +324,14 @@ void nfc_worker_emulate_uid(NfcWorker* nfc_worker) { FuriHalNfcDevData* data = &nfc_worker->dev_data->nfc_data; NfcReaderRequestData* reader_data = &nfc_worker->dev_data->reader_data; + // TODO add support for RATS + // Now remove bit 6 in SAK to support ISO-14443A-3 emulation + // Need to save ATS to support ISO-14443A-4 emulation + uint8_t sak = data->sak; + FURI_BIT_CLEAR(sak, 5); + while(nfc_worker->state == NfcWorkerStateUidEmulate) { - if(furi_hal_nfc_listen(data->uid, data->uid_len, data->atqa, data->sak, true, 100)) { + if(furi_hal_nfc_listen(data->uid, data->uid_len, data->atqa, sak, true, 100)) { if(furi_hal_nfc_tx_rx(&tx_rx, 100)) { reader_data->size = tx_rx.rx_bits / 8; if(reader_data->size > 0) {