mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 06:18:35 -07:00
Merge branch 'ofwdev' into 420
This commit is contained in:
@@ -27,11 +27,13 @@ void nfc_scene_mf_ultralight_read_auth_set_state(Nfc* nfc, NfcSceneMfUlReadState
|
|||||||
popup_set_text(
|
popup_set_text(
|
||||||
nfc->popup, "Apply Card To\nFlipper's Back", 97, 24, AlignCenter, AlignTop);
|
nfc->popup, "Apply Card To\nFlipper's Back", 97, 24, AlignCenter, AlignTop);
|
||||||
popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual_60x50);
|
popup_set_icon(nfc->popup, 0, 8, &I_NFC_manual_60x50);
|
||||||
|
nfc_blink_read_start(nfc);
|
||||||
} else if(state == NfcSceneMfUlReadStateReading) {
|
} else if(state == NfcSceneMfUlReadStateReading) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_header(
|
popup_set_header(
|
||||||
nfc->popup, "Reading Card\nDon't Move...", 85, 24, AlignCenter, AlignTop);
|
nfc->popup, "Reading Card\nDon't Move...", 85, 24, AlignCenter, AlignTop);
|
||||||
popup_set_icon(nfc->popup, 12, 23, &A_Loading_24);
|
popup_set_icon(nfc->popup, 12, 23, &A_Loading_24);
|
||||||
|
nfc_blink_detect_start(nfc);
|
||||||
} else if(state == NfcSceneMfUlReadStateNotSupportedCard) {
|
} else if(state == NfcSceneMfUlReadStateNotSupportedCard) {
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
popup_set_header(nfc->popup, "Wrong Type Of Card!", 64, 3, AlignCenter, AlignTop);
|
popup_set_header(nfc->popup, "Wrong Type Of Card!", 64, 3, AlignCenter, AlignTop);
|
||||||
@@ -43,6 +45,9 @@ void nfc_scene_mf_ultralight_read_auth_set_state(Nfc* nfc, NfcSceneMfUlReadState
|
|||||||
AlignLeft,
|
AlignLeft,
|
||||||
AlignTop);
|
AlignTop);
|
||||||
popup_set_icon(nfc->popup, 73, 20, &I_DolphinCommon_56x48);
|
popup_set_icon(nfc->popup, 73, 20, &I_DolphinCommon_56x48);
|
||||||
|
nfc_blink_stop(nfc);
|
||||||
|
notification_message(nfc->notifications, &sequence_error);
|
||||||
|
notification_message(nfc->notifications, &sequence_set_red_255);
|
||||||
}
|
}
|
||||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightReadAuth, state);
|
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightReadAuth, state);
|
||||||
}
|
}
|
||||||
@@ -62,8 +67,6 @@ void nfc_scene_mf_ultralight_read_auth_on_enter(void* context) {
|
|||||||
&nfc->dev->dev_data,
|
&nfc->dev->dev_data,
|
||||||
nfc_scene_mf_ultralight_read_auth_worker_callback,
|
nfc_scene_mf_ultralight_read_auth_worker_callback,
|
||||||
nfc);
|
nfc);
|
||||||
|
|
||||||
nfc_blink_read_start(nfc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nfc_scene_mf_ultralight_read_auth_on_event(void* context, SceneManagerEvent event) {
|
bool nfc_scene_mf_ultralight_read_auth_on_event(void* context, SceneManagerEvent event) {
|
||||||
@@ -86,8 +89,17 @@ bool nfc_scene_mf_ultralight_read_auth_on_event(void* context, SceneManagerEvent
|
|||||||
nfc, NfcSceneMfUlReadStateNotSupportedCard);
|
nfc, NfcSceneMfUlReadStateNotSupportedCard);
|
||||||
}
|
}
|
||||||
} else if(event.type == SceneManagerEventTypeBack) {
|
} else if(event.type == SceneManagerEventTypeBack) {
|
||||||
consumed = scene_manager_search_and_switch_to_previous_scene(
|
MfUltralightData* mf_ul_data = &nfc->dev->dev_data.mf_ul_data;
|
||||||
nfc->scene_manager, NfcSceneMfUltralightUnlockMenu);
|
NfcScene next_scene;
|
||||||
|
if(mf_ul_data->auth_method == MfUltralightAuthMethodManual) {
|
||||||
|
next_scene = NfcSceneMfUltralightKeyInput;
|
||||||
|
} else if(mf_ul_data->auth_method == MfUltralightAuthMethodAuto) {
|
||||||
|
next_scene = NfcSceneMfUltralightUnlockAuto;
|
||||||
|
} else {
|
||||||
|
next_scene = NfcSceneMfUltralightUnlockMenu;
|
||||||
|
}
|
||||||
|
consumed =
|
||||||
|
scene_manager_search_and_switch_to_previous_scene(nfc->scene_manager, next_scene);
|
||||||
}
|
}
|
||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ void nfc_scene_mf_ultralight_read_auth_result_on_enter(void* context) {
|
|||||||
nfc);
|
nfc);
|
||||||
|
|
||||||
furi_string_free(temp_str);
|
furi_string_free(temp_str);
|
||||||
|
notification_message(nfc->notifications, &sequence_set_green_255);
|
||||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,4 +111,6 @@ void nfc_scene_mf_ultralight_read_auth_result_on_exit(void* context) {
|
|||||||
|
|
||||||
// Clean views
|
// Clean views
|
||||||
widget_reset(nfc->widget);
|
widget_reset(nfc->widget);
|
||||||
|
|
||||||
|
notification_message_block(nfc->notifications, &sequence_reset_green);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,17 @@ void nfc_scene_mf_ultralight_unlock_auto_on_enter(void* context) {
|
|||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
|
|
||||||
// Setup view
|
// Setup view
|
||||||
popup_set_text(nfc->popup, "Touch the reader", 44, 31, AlignLeft, AlignCenter);
|
widget_add_string_multiline_element(
|
||||||
popup_set_icon(nfc->popup, 0, 16, &I_Tap_reader_36x38);
|
nfc->widget,
|
||||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
|
54,
|
||||||
|
30,
|
||||||
|
AlignLeft,
|
||||||
|
AlignCenter,
|
||||||
|
FontPrimary,
|
||||||
|
"Touch the\nreader to get\npassword...");
|
||||||
|
widget_add_icon_element(nfc->widget, 0, 15, &I_Modern_reader_18x34);
|
||||||
|
widget_add_icon_element(nfc->widget, 20, 12, &I_Move_flipper_26x39);
|
||||||
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
||||||
|
|
||||||
// Start worker
|
// Start worker
|
||||||
nfc_worker_start(
|
nfc_worker_start(
|
||||||
@@ -34,7 +42,7 @@ bool nfc_scene_mf_ultralight_unlock_auto_on_event(void* context, SceneManagerEve
|
|||||||
if((event.event == NfcWorkerEventMfUltralightPwdAuth)) {
|
if((event.event == NfcWorkerEventMfUltralightPwdAuth)) {
|
||||||
MfUltralightAuth* auth = &nfc->dev->dev_data.mf_ul_auth;
|
MfUltralightAuth* auth = &nfc->dev->dev_data.mf_ul_auth;
|
||||||
memcpy(nfc->byte_input_store, auth->pwd.raw, sizeof(auth->pwd.raw));
|
memcpy(nfc->byte_input_store, auth->pwd.raw, sizeof(auth->pwd.raw));
|
||||||
nfc->dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodManual;
|
nfc->dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodAuto;
|
||||||
nfc_worker_stop(nfc->worker);
|
nfc_worker_stop(nfc->worker);
|
||||||
notification_message(nfc->notifications, &sequence_success);
|
notification_message(nfc->notifications, &sequence_success);
|
||||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightUnlockWarn);
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightUnlockWarn);
|
||||||
@@ -51,6 +59,7 @@ void nfc_scene_mf_ultralight_unlock_auto_on_exit(void* context) {
|
|||||||
nfc_worker_stop(nfc->worker);
|
nfc_worker_stop(nfc->worker);
|
||||||
// Clear view
|
// Clear view
|
||||||
popup_reset(nfc->popup);
|
popup_reset(nfc->popup);
|
||||||
|
widget_reset(nfc->widget);
|
||||||
|
|
||||||
nfc_blink_stop(nfc);
|
nfc_blink_stop(nfc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "../nfc_i.h"
|
#include "../nfc_i.h"
|
||||||
|
|
||||||
enum SubmenuIndex {
|
enum SubmenuIndex {
|
||||||
SubmenuIndexMfUlUnlockMenuManual,
|
SubmenuIndexMfUlUnlockMenuAuto,
|
||||||
SubmenuIndexMfUlUnlockMenuAmeebo,
|
SubmenuIndexMfUlUnlockMenuAmeebo,
|
||||||
SubmenuIndexMfUlUnlockMenuXiaomi,
|
SubmenuIndexMfUlUnlockMenuXiaomi,
|
||||||
|
SubmenuIndexMfUlUnlockMenuManual,
|
||||||
};
|
};
|
||||||
|
|
||||||
void nfc_scene_mf_ultralight_unlock_menu_submenu_callback(void* context, uint32_t index) {
|
void nfc_scene_mf_ultralight_unlock_menu_submenu_callback(void* context, uint32_t index) {
|
||||||
@@ -18,12 +19,14 @@ void nfc_scene_mf_ultralight_unlock_menu_on_enter(void* context) {
|
|||||||
|
|
||||||
uint32_t state =
|
uint32_t state =
|
||||||
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightUnlockMenu);
|
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightUnlockMenu);
|
||||||
submenu_add_item(
|
if(nfc->dev->dev_data.protocol == NfcDeviceProtocolMifareUl) {
|
||||||
submenu,
|
submenu_add_item(
|
||||||
"Enter PWD Manually",
|
submenu,
|
||||||
SubmenuIndexMfUlUnlockMenuManual,
|
"Unlock With Reader",
|
||||||
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
SubmenuIndexMfUlUnlockMenuAuto,
|
||||||
nfc);
|
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
||||||
|
nfc);
|
||||||
|
}
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Auth As Ameebo",
|
"Auth As Ameebo",
|
||||||
@@ -32,10 +35,16 @@ void nfc_scene_mf_ultralight_unlock_menu_on_enter(void* context) {
|
|||||||
nfc);
|
nfc);
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"Auth As Xiaomi",
|
"Auth As Xiaomi Air Purifier",
|
||||||
SubmenuIndexMfUlUnlockMenuXiaomi,
|
SubmenuIndexMfUlUnlockMenuXiaomi,
|
||||||
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
||||||
nfc);
|
nfc);
|
||||||
|
submenu_add_item(
|
||||||
|
submenu,
|
||||||
|
"Enter Password Manually",
|
||||||
|
SubmenuIndexMfUlUnlockMenuManual,
|
||||||
|
nfc_scene_mf_ultralight_unlock_menu_submenu_callback,
|
||||||
|
nfc);
|
||||||
submenu_set_selected_item(submenu, state);
|
submenu_set_selected_item(submenu, state);
|
||||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
|
||||||
}
|
}
|
||||||
@@ -57,6 +66,9 @@ bool nfc_scene_mf_ultralight_unlock_menu_on_event(void* context, SceneManagerEve
|
|||||||
nfc->dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodXiaomi;
|
nfc->dev->dev_data.mf_ul_data.auth_method = MfUltralightAuthMethodXiaomi;
|
||||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightUnlockWarn);
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightUnlockWarn);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
|
} else if(event.event == SubmenuIndexMfUlUnlockMenuAuto) {
|
||||||
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightUnlockAuto);
|
||||||
|
consumed = true;
|
||||||
}
|
}
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
nfc->scene_manager, NfcSceneMfUltralightUnlockMenu, event.event);
|
nfc->scene_manager, NfcSceneMfUltralightUnlockMenu, event.event);
|
||||||
|
|||||||
@@ -10,15 +10,43 @@ void nfc_scene_mf_ultralight_unlock_warn_dialog_callback(DialogExResult result,
|
|||||||
void nfc_scene_mf_ultralight_unlock_warn_on_enter(void* context) {
|
void nfc_scene_mf_ultralight_unlock_warn_on_enter(void* context) {
|
||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
DialogEx* dialog_ex = nfc->dialog_ex;
|
DialogEx* dialog_ex = nfc->dialog_ex;
|
||||||
|
MfUltralightAuthMethod auth_method = nfc->dev->dev_data.mf_ul_data.auth_method;
|
||||||
|
|
||||||
dialog_ex_set_context(dialog_ex, nfc);
|
dialog_ex_set_context(dialog_ex, nfc);
|
||||||
dialog_ex_set_result_callback(dialog_ex, nfc_scene_mf_ultralight_unlock_warn_dialog_callback);
|
dialog_ex_set_result_callback(dialog_ex, nfc_scene_mf_ultralight_unlock_warn_dialog_callback);
|
||||||
|
|
||||||
dialog_ex_set_header(dialog_ex, "Risky Function!", 64, 4, AlignCenter, AlignTop);
|
if(auth_method == MfUltralightAuthMethodManual || auth_method == MfUltralightAuthMethodAuto) {
|
||||||
dialog_ex_set_text(
|
// Build dialog text
|
||||||
dialog_ex, "Wrong password\ncan block your\ncard.", 4, 18, AlignLeft, AlignTop);
|
MfUltralightAuth* auth = &nfc->dev->dev_data.mf_ul_auth;
|
||||||
dialog_ex_set_icon(dialog_ex, 73, 20, &I_DolphinCommon_56x48);
|
FuriString* password_str =
|
||||||
dialog_ex_set_center_button_text(dialog_ex, "OK");
|
furi_string_alloc_set_str("Try to unlock the card with\npassword: ");
|
||||||
|
for(size_t i = 0; i < sizeof(auth->pwd.raw); ++i) {
|
||||||
|
furi_string_cat_printf(password_str, "%02X ", nfc->byte_input_store[i]);
|
||||||
|
}
|
||||||
|
furi_string_cat_str(password_str, "?\nCaution, a wrong password\ncan block the card!");
|
||||||
|
nfc_text_store_set(nfc, furi_string_get_cstr(password_str));
|
||||||
|
furi_string_free(password_str);
|
||||||
|
|
||||||
|
dialog_ex_set_header(
|
||||||
|
dialog_ex,
|
||||||
|
auth_method == MfUltralightAuthMethodAuto ? "Password captured!" : "Risky function!",
|
||||||
|
64,
|
||||||
|
0,
|
||||||
|
AlignCenter,
|
||||||
|
AlignTop);
|
||||||
|
dialog_ex_set_text(dialog_ex, nfc->text_store, 64, 12, AlignCenter, AlignTop);
|
||||||
|
dialog_ex_set_left_button_text(dialog_ex, "Cancel");
|
||||||
|
dialog_ex_set_right_button_text(dialog_ex, "Continue");
|
||||||
|
|
||||||
|
if(auth_method == MfUltralightAuthMethodAuto)
|
||||||
|
notification_message(nfc->notifications, &sequence_set_green_255);
|
||||||
|
} else {
|
||||||
|
dialog_ex_set_header(dialog_ex, "Risky function!", 64, 4, AlignCenter, AlignTop);
|
||||||
|
dialog_ex_set_text(
|
||||||
|
dialog_ex, "Wrong password\ncan block your\ncard.", 4, 18, AlignLeft, AlignTop);
|
||||||
|
dialog_ex_set_icon(dialog_ex, 73, 20, &I_DolphinCommon_56x48);
|
||||||
|
dialog_ex_set_center_button_text(dialog_ex, "OK");
|
||||||
|
}
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewDialogEx);
|
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewDialogEx);
|
||||||
}
|
}
|
||||||
@@ -28,12 +56,33 @@ bool nfc_scene_mf_ultralight_unlock_warn_on_event(void* context, SceneManagerEve
|
|||||||
|
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
MfUltralightAuthMethod auth_method = nfc->dev->dev_data.mf_ul_data.auth_method;
|
||||||
if(event.event == DialogExResultCenter) {
|
if(auth_method == MfUltralightAuthMethodManual || auth_method == MfUltralightAuthMethodAuto) {
|
||||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadAuth);
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
DOLPHIN_DEED(DolphinDeedNfcRead);
|
if(event.event == DialogExResultRight) {
|
||||||
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadAuth);
|
||||||
|
DOLPHIN_DEED(DolphinDeedNfcRead);
|
||||||
|
consumed = true;
|
||||||
|
} else if(event.event == DialogExResultLeft) {
|
||||||
|
if(auth_method == MfUltralightAuthMethodAuto) {
|
||||||
|
consumed = scene_manager_search_and_switch_to_previous_scene(
|
||||||
|
nfc->scene_manager, NfcSceneMfUltralightUnlockMenu);
|
||||||
|
} else {
|
||||||
|
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(event.type == SceneManagerEventTypeBack) {
|
||||||
|
// Cannot press back
|
||||||
consumed = true;
|
consumed = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
|
if(event.event == DialogExResultCenter) {
|
||||||
|
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfUltralightReadAuth);
|
||||||
|
DOLPHIN_DEED(DolphinDeedNfcRead);
|
||||||
|
consumed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return consumed;
|
return consumed;
|
||||||
@@ -43,5 +92,7 @@ void nfc_scene_mf_ultralight_unlock_warn_on_exit(void* context) {
|
|||||||
Nfc* nfc = context;
|
Nfc* nfc = context;
|
||||||
|
|
||||||
dialog_ex_reset(nfc->dialog_ex);
|
dialog_ex_reset(nfc->dialog_ex);
|
||||||
submenu_reset(nfc->submenu);
|
nfc_text_store_clear(nfc);
|
||||||
|
|
||||||
|
notification_message_block(nfc->notifications, &sequence_reset_green);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,7.52,,
|
Version,+,7.6,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/cli/cli.h,,
|
Header,+,applications/services/cli/cli.h,,
|
||||||
Header,+,applications/services/cli/cli_vcp.h,,
|
Header,+,applications/services/cli/cli_vcp.h,,
|
||||||
|
|||||||
|
@@ -1253,7 +1253,8 @@ void nfc_worker_mf_ultralight_read_auth(NfcWorker* nfc_worker) {
|
|||||||
if(furi_hal_nfc_detect(nfc_data, 300) && nfc_data->type == FuriHalNfcTypeA) {
|
if(furi_hal_nfc_detect(nfc_data, 300) && nfc_data->type == FuriHalNfcTypeA) {
|
||||||
if(mf_ul_check_card_type(nfc_data->atqa[0], nfc_data->atqa[1], nfc_data->sak)) {
|
if(mf_ul_check_card_type(nfc_data->atqa[0], nfc_data->atqa[1], nfc_data->sak)) {
|
||||||
nfc_worker->callback(NfcWorkerEventCardDetected, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventCardDetected, nfc_worker->context);
|
||||||
if(data->auth_method == MfUltralightAuthMethodManual) {
|
if(data->auth_method == MfUltralightAuthMethodManual ||
|
||||||
|
data->auth_method == MfUltralightAuthMethodAuto) {
|
||||||
nfc_worker->callback(NfcWorkerEventMfUltralightPassKey, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventMfUltralightPassKey, nfc_worker->context);
|
||||||
key = nfc_util_bytes2num(data->auth_key, 4);
|
key = nfc_util_bytes2num(data->auth_key, 4);
|
||||||
} else if(data->auth_method == MfUltralightAuthMethodAmeebo) {
|
} else if(data->auth_method == MfUltralightAuthMethodAmeebo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user