Merge branch 'dev' into astra/3746-mfp-detect

This commit is contained in:
gornekich
2024-05-14 17:12:37 +01:00
committed by GitHub
78 changed files with 823 additions and 208 deletions

View File

@@ -17,6 +17,5 @@ ADD_SCENE(ibutton, delete_confirm, DeleteConfirm)
ADD_SCENE(ibutton, delete_success, DeleteSuccess)
ADD_SCENE(ibutton, retry_confirm, RetryConfirm)
ADD_SCENE(ibutton, exit_confirm, ExitConfirm)
ADD_SCENE(ibutton, read_exit_confirm, ReadExitConfirm)
ADD_SCENE(ibutton, view_data, ViewData)
ADD_SCENE(ibutton, rpc, Rpc)

View File

@@ -1,59 +0,0 @@
#include "../ibutton_i.h"
static void ibutton_scene_read_exit_confirm_widget_callback(
GuiButtonType result,
InputType type,
void* context) {
iButton* ibutton = context;
if(type == InputTypeShort) {
view_dispatcher_send_custom_event(ibutton->view_dispatcher, result);
}
}
void ibutton_scene_read_exit_confirm_on_enter(void* context) {
iButton* ibutton = context;
Widget* widget = ibutton->widget;
widget_add_button_element(
widget,
GuiButtonTypeLeft,
"Exit",
ibutton_scene_read_exit_confirm_widget_callback,
ibutton);
widget_add_button_element(
widget,
GuiButtonTypeRight,
"Stay",
ibutton_scene_read_exit_confirm_widget_callback,
ibutton);
widget_add_string_element(
widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Retry Reading?");
widget_add_string_element(
widget, 64, 31, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost!");
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);
}
bool ibutton_scene_read_exit_confirm_on_event(void* context, SceneManagerEvent event) {
iButton* ibutton = context;
SceneManager* scene_manager = ibutton->scene_manager;
bool consumed = false;
if(event.type == SceneManagerEventTypeBack) {
consumed = true; // Ignore Back button presses
} else if(event.type == SceneManagerEventTypeCustom) {
consumed = true;
if(event.event == GuiButtonTypeLeft) {
scene_manager_search_and_switch_to_previous_scene(scene_manager, iButtonSceneRead);
} else if(event.event == GuiButtonTypeRight) {
scene_manager_previous_scene(scene_manager);
}
}
return consumed;
}
void ibutton_scene_read_exit_confirm_on_exit(void* context) {
iButton* ibutton = context;
widget_reset(ibutton->widget);
}

View File

@@ -44,7 +44,7 @@ bool ibutton_scene_read_success_on_event(void* context, SceneManagerEvent event)
if(event.type == SceneManagerEventTypeBack) {
consumed = true;
scene_manager_next_scene(scene_manager, iButtonSceneReadExitConfirm);
scene_manager_next_scene(scene_manager, iButtonSceneExitConfirm);
} else if(event.type == SceneManagerEventTypeCustom) {
consumed = true;
if(event.event == GuiButtonTypeRight) {

View File

@@ -15,7 +15,7 @@ void ibutton_scene_retry_confirm_on_enter(void* context) {
Widget* widget = ibutton->widget;
widget_add_button_element(
widget, GuiButtonTypeLeft, "Exit", ibutton_scene_retry_confirm_widget_callback, ibutton);
widget, GuiButtonTypeLeft, "Retry", ibutton_scene_retry_confirm_widget_callback, ibutton);
widget_add_button_element(
widget, GuiButtonTypeRight, "Stay", ibutton_scene_retry_confirm_widget_callback, ibutton);
widget_add_string_element(

View File

@@ -826,3 +826,35 @@ type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3302 1640 404 423 407 420 410 1212 437 390 440 1234 405 395 435 392 438 415 415 1207 432 1242 407 420 410 391 439 414 405 1243 406 1241 408 392 438 415 415 386 433 393 437 390 440 414 405 396 434 419 411 389 441 412 407 420 410 390 440 387 432 1242 407 393 437 390 440 414 405 395 435 392 438 389 430 396 434 1240 409 417 413 414 405 395 435 419 411 1237 412 389 430 396 434 393 437 416 414 387 432 394 436 1212 437 389 441 1234 405 1217 432 1241 408 1213 436 1212 437 1210 439
#
# Model: Toshiba RAS-2518D
#
name: Dh
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4349 4437 549 1615 551 1614 551 1614 551 1617 549 531 550 530 551 1615 550 531 550 532 549 530 551 531 550 530 551 1615 550 1614 551 531 550 1615 551 529 552 531 550 530 551 533 548 530 551 530 551 1616 549 1615 550 1616 550 1615 550 1614 551 1616 550 1615 551 1615 550 531 550 531 550 530 551 529 552 530 551 530 551 529 552 530 551 531 550 1615 550 532 549 1615 550 1616 550 531 550 531 550 530 551 530 551 529 552 532 549 530 551 530 551 531 550 529 552 531 550 1615 551 530 551 530 551 530 551 531 550 530 551 531 550 530 551 531 550 531 550 531 550 1616 550 1618 547 532 549 529 552 530 551 1615 551 1615 550 5379 4350 4436 550 1616 549 1615 551 1614 552 1615 550 529 552 530 551 1614 552 530 551 529 552 531 550 531 550 531 550 1614 552 1614 551 530 551 1615 550 530 551 530 551 530 551 530 551 531 550 532 549 1616 549 1615 551 1614 552 1615 550 1614 551 1616 550 1614 552 1615 550 529 552 530 551 530 551 530 551 531 550 531 550 530 551 530 551 531 550 1615 550 530 551 1615 550 1615 551 530 551 530 551 530 551 530 551 530 551 530 551 529 552 530 551 531 550 532 549 530 551 1615 551 531 550 530 551 530 551 530 551 530 551 531 550 531 550 531 550 530 551 531 550 1615 551 1615 551 532 549 531 550 531 550 1616 549 1614 552
#
name: Cool_hi
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4350 4438 549 1615 551 1614 552 1616 549 1616 550 530 551 531 550 1615 551 530 551 529 552 531 550 530 551 531 550 1614 551 1616 550 531 550 1616 549 530 551 531 550 530 551 529 552 530 551 531 550 1616 549 1616 550 1616 549 1616 550 1615 551 1614 551 1614 552 1615 551 530 551 531 550 530 551 531 550 531 550 529 552 532 549 531 550 530 551 1613 552 530 551 531 550 529 552 532 549 530 551 530 551 531 550 531 550 530 551 530 551 530 551 531 550 530 551 531 550 531 550 1615 551 529 552 530 551 530 551 530 551 530 551 530 551 530 551 530 551 532 549 531 550 531 550 532 549 531 550 531 550 530 551 530 551 5132 4351 4435 552 1616 550 1615 550 1615 551 1613 553 531 550 530 551 1615 550 530 551 531 550 531 550 530 551 532 549 1616 550 1616 549 530 551 1615 551 530 551 531 550 530 551 530 551 530 551 531 550 1615 551 1615 551 1614 551 1615 550 1615 551 1615 550 1615 550 1616 550 530 551 530 551 531 550 532 549 530 551 530 551 531 550 531 550 531 550 1615 550 530 551 530 551 530 551 529 552 531 550 530 551 531 550 531 550 530 551 530 551 531 550 530 551 530 551 530 551 531 550 1616 550 530 551 529 552 530 551 531 550 532 549 530 551 530 551 529 552 531 550 529 552 530 551 530 551 531 550 531 550 529 552 531 550
#
name: Cool_lo
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4350 4436 550 1617 549 1615 550 1615 550 1617 548 530 551 531 550 1615 551 531 550 531 550 530 551 530 551 531 550 1614 552 1615 550 530 551 1614 551 531 550 531 550 531 550 529 552 532 549 530 551 1617 549 1616 549 1615 551 1619 547 1615 550 1615 550 1616 549 1616 550 530 551 531 550 530 551 530 551 531 550 530 551 529 552 529 552 530 551 1617 548 533 548 1615 551 1613 552 530 551 531 550 531 550 530 551 530 551 532 549 531 550 531 550 530 551 531 550 531 550 531 550 1615 551 531 550 531 550 532 549 531 550 530 551 531 550 533 548 531 550 530 551 1617 548 1616 549 530 551 531 550 532 549 532 549 532 549 5200 4349 4436 550 1615 551 1615 551 1615 550 1616 550 531 550 530 551 1615 551 531 550 530 551 530 551 530 551 530 551 1616 549 1615 551 530 551 1615 551 531 550 531 550 530 551 531 550 531 550 531 550 1615 551 1616 550 1616 550 1615 550 1617 548 1616 549 1616 550 1615 550 531 550 530 551 531 550 531 550 532 549 530 551 531 550 531 550 532 549 1616 550 531 550 1616 550 1615 550 531 550 530 551 531 550 531 550 531 550 531 550 531 550 532 549 532 549 531 550 532 549 531 550 1616 550 531 550 530 551 532 549 532 549 530 551 532 549 531 550 532 549 531 550 1616 549 1617 549 531 550 530 551 531 550 532 549 532 549
#
name: Heat_hi
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4350 4437 547 1618 548 1620 546 1620 546 1619 547 534 547 535 546 1619 547 534 547 536 545 536 545 535 546 535 546 1619 547 1620 545 534 523 1644 546 535 522 559 546 535 546 534 547 535 546 535 545 1620 546 1620 546 1620 546 1619 547 1619 546 1619 547 1620 545 1620 546 535 546 534 547 537 520 558 523 558 547 534 547 536 521 559 522 559 522 1644 546 535 546 535 522 560 545 536 521 559 522 559 522 558 523 559 522 560 521 559 522 559 522 560 521 559 522 561 520 1644 521 1645 520 559 522 559 522 559 522 559 522 559 522 560 521 560 521 560 521 561 520 559 522 560 521 559 522 559 522 559 522 1644 522 559 522 5341 4349 4439 520 1645 521 1645 521 1646 519 1645 521 560 521 561 520 1645 521 560 521 560 521 559 522 560 521 561 520 1646 520 1645 521 561 520 1645 521 561 520 560 521 560 521 560 521 560 521 561 520 1644 522 1644 522 1645 520 1645 521 1645 521 1645 520 1646 520 1644 522 561 520 560 521 560 521 561 520 560 521 561 520 561 520 561 520 560 521 1646 520 562 519 561 520 561 520 562 519 560 521 560 521 561 520 561 520 560 521 560 521 561 520 560 521 560 521 562 519 1646 520 1645 521 561 520 561 520 561 520 560 521 560 521 561 520 560 521 559 522 560 521 561 520 561 520 560 521 562 519 559 522 1645 521 561 520
#
name: Heat_lo
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4348 4439 520 1646 520 1646 520 1646 519 1646 520 561 520 561 520 1646 519 561 520 561 520 562 519 562 519 561 520 1646 520 1647 518 563 518 1646 519 562 519 561 520 561 520 562 519 562 519 561 520 1648 517 1647 519 1646 519 1647 519 1646 520 1646 520 1645 520 1647 519 561 520 561 520 562 519 562 519 562 519 562 519 561 520 562 519 561 520 1646 520 562 519 1647 518 1646 520 562 519 560 521 561 520 561 520 561 520 562 519 562 519 560 521 562 519 562 519 560 521 1646 520 1646 520 561 520 562 519 561 520 562 519 561 520 561 520 561 520 561 520 561 520 1647 518 1646 520 562 519 562 519 561 520 1646 520 561 520 5409 4348 4440 519 1645 521 1646 519 1645 521 1645 521 561 520 561 520 1644 522 561 520 561 520 561 520 560 521 562 519 1646 520 1646 520 562 519 1644 522 561 520 561 520 561 520 561 520 561 520 561 520 1646 520 1645 520 1646 520 1645 521 1646 520 1646 520 1644 522 1645 521 560 521 560 521 561 520 561 520 560 521 560 521 561 520 561 520 561 520 1645 521 562 519 1645 521 1645 520 561 520 562 519 561 520 561 520 561 520 560 521 560 521 560 521 560 521 561 520 560 521 1646 520 1646 520 561 520 560 521 559 522 560 521 561 520 561 520 560 521 560 521 560 521 1646 520 1645 520 561 520 560 521 560 521 1645 521 561 520

View File

@@ -506,7 +506,7 @@ bool mosgortrans_parse_transport_block(const MfClassicBlock* block, FuriString*
if(data_block.valid_from_date == 0 || data_block.valid_to_date == 0) {
furi_string_cat(result, "\e#No ticket");
return true;
return false;
}
//remaining_trips
furi_string_cat_printf(result, "Trips: %d\n", data_block.total_trips);

View File

@@ -2,6 +2,8 @@
#include "../iso14443_4a/iso14443_4a_render.h"
#define MF_DESFIRE_RENDER_MAX_RECORD_SIZE (256U)
void nfc_render_mf_desfire_info(
const MfDesfireData* data,
NfcProtocolFormatType format_type,
@@ -212,8 +214,6 @@ void nfc_render_mf_desfire_file_settings_data(
uint32_t record_count = 1;
uint32_t record_size = 0;
const uint32_t total_size = simple_array_get_count(data->data);
switch(settings->type) {
case MfDesfireFileTypeStandard:
case MfDesfireFileTypeBackup:
@@ -257,17 +257,14 @@ void nfc_render_mf_desfire_file_settings_data(
return;
}
for(uint32_t rec = 0; rec < record_count; rec++) {
const uint32_t size_offset = rec * record_size;
const uint32_t size_remaining = total_size > size_offset ? total_size - size_offset : 0;
// Limit record size
bool trim_data = record_size > MF_DESFIRE_RENDER_MAX_RECORD_SIZE;
if(trim_data) {
record_size = MF_DESFIRE_RENDER_MAX_RECORD_SIZE;
}
if(size_remaining < record_size) {
furi_string_cat_printf(
str, "record %lu (partial %lu of %lu)\n", rec, size_remaining, record_size);
record_size = size_remaining;
} else {
furi_string_cat_printf(str, "record %lu\n", rec);
}
for(uint32_t rec = 0; rec < record_count; rec++) {
furi_string_cat_printf(str, "record %lu\n", rec);
for(uint32_t ch = 0; ch < record_size; ch += 4) {
furi_string_cat_printf(str, "%03lx|", ch);
@@ -296,6 +293,9 @@ void nfc_render_mf_desfire_file_settings_data(
furi_string_push_back(str, '\n');
}
if(trim_data) {
furi_string_cat_str(str, "...");
}
furi_string_push_back(str, '\n');
}

View File

@@ -83,6 +83,20 @@ static const MfClassicKeyPair troika_4k_keys[] = {
{.a = 0xBB52F8CCE07F, .b = 0x6B6119752C70}, //40
};
static void troika_render_section_header(
FuriString* str,
const char* name,
uint8_t prefix_separator_cnt,
uint8_t suffix_separator_cnt) {
for(uint8_t i = 0; i < prefix_separator_cnt; i++) {
furi_string_cat_printf(str, ":");
}
furi_string_cat_printf(str, "[ %s ]", name);
for(uint8_t i = 0; i < suffix_separator_cnt; i++) {
furi_string_cat_printf(str, ":");
}
}
static bool troika_get_card_config(TroikaCardConfig* config, MfClassicType type) {
bool success = true;
@@ -204,18 +218,19 @@ static bool troika_parse(const NfcDevice* device, FuriString* parsed_data) {
bool result3 = mosgortrans_parse_transport_block(&data->block[16], tat_result);
furi_string_cat_printf(parsed_data, "\e#Troyka card\n");
if(result1) {
furi_string_cat_printf(
parsed_data, "\e#Metro\n%s\n", furi_string_get_cstr(metro_result));
if(result1 && !furi_string_empty(metro_result)) {
troika_render_section_header(parsed_data, "Metro", 22, 21);
furi_string_cat_printf(parsed_data, "%s\n", furi_string_get_cstr(metro_result));
}
if(result2) {
furi_string_cat_printf(
parsed_data, "\n\e#Ediniy\n%s\n", furi_string_get_cstr(ground_result));
if(result2 && !furi_string_empty(ground_result)) {
troika_render_section_header(parsed_data, "Ediny", 22, 22);
furi_string_cat_printf(parsed_data, "%s\n", furi_string_get_cstr(ground_result));
}
if(result3) {
furi_string_cat_printf(parsed_data, "\n\e#TAT\n%s", furi_string_get_cstr(tat_result));
if(result3 && !furi_string_empty(tat_result)) {
troika_render_section_header(parsed_data, "TAT", 24, 23);
furi_string_cat_printf(parsed_data, "%s\n", furi_string_get_cstr(tat_result));
}
furi_string_free(tat_result);

View File

@@ -61,11 +61,11 @@ static void desktop_clock_update(Desktop* desktop) {
furi_hal_rtc_get_datetime(&curr_dt);
bool time_format_12 = locale_get_time_format() == LocaleTimeFormat12h;
if(desktop->time_hour != curr_dt.hour || desktop->time_minute != curr_dt.minute ||
desktop->time_format_12 != time_format_12) {
desktop->time_format_12 = time_format_12;
desktop->time_hour = curr_dt.hour;
desktop->time_minute = curr_dt.minute;
if(desktop->clock.hour != curr_dt.hour || desktop->clock.minute != curr_dt.minute ||
desktop->clock.format_12 != time_format_12) {
desktop->clock.format_12 = time_format_12;
desktop->clock.hour = curr_dt.hour;
desktop->clock.minute = curr_dt.minute;
view_port_update(desktop->clock_viewport);
}
}
@@ -92,8 +92,8 @@ static void desktop_clock_draw_callback(Canvas* canvas, void* context) {
canvas_set_font(canvas, FontPrimary);
uint8_t hour = desktop->time_hour;
if(desktop->time_format_12) {
uint8_t hour = desktop->clock.hour;
if(desktop->clock.format_12) {
if(hour > 12) {
hour -= 12;
}
@@ -103,11 +103,11 @@ static void desktop_clock_draw_callback(Canvas* canvas, void* context) {
}
char buffer[20];
snprintf(buffer, sizeof(buffer), "%02u:%02u", hour, desktop->time_minute);
snprintf(buffer, sizeof(buffer), "%02u:%02u", hour, desktop->clock.minute);
view_port_set_width(
desktop->clock_viewport,
canvas_string_width(canvas, buffer) - 1 + (desktop->time_minute % 10 == 1));
canvas_string_width(canvas, buffer) - 1 + (desktop->clock.minute % 10 == 1));
canvas_draw_str_aligned(canvas, 0, 8, AlignLeft, AlignBottom, buffer);
}
@@ -139,7 +139,7 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
desktop_auto_lock_arm(desktop);
return true;
case DesktopGlobalAutoLock:
if(!loader_is_locked(desktop->loader)) {
if(!loader_is_locked(desktop->loader) && !desktop->locked) {
desktop_lock(desktop);
}
return true;
@@ -215,6 +215,8 @@ static void desktop_clock_timer_callback(void* context) {
}
void desktop_lock(Desktop* desktop) {
furi_assert(!desktop->locked);
furi_hal_rtc_set_flag(FuriHalRtcFlagLock);
if(desktop->settings.pin_code.length) {
@@ -230,9 +232,13 @@ void desktop_lock(Desktop* desktop) {
DesktopStatus status = {.locked = true};
furi_pubsub_publish(desktop->status_pubsub, &status);
desktop->locked = true;
}
void desktop_unlock(Desktop* desktop) {
furi_assert(desktop->locked);
view_port_enabled_set(desktop->lock_icon_viewport, false);
Gui* gui = furi_record_open(RECORD_GUI);
gui_set_lockdown(gui, false);
@@ -251,6 +257,8 @@ void desktop_unlock(Desktop* desktop) {
DesktopStatus status = {.locked = false};
furi_pubsub_publish(desktop->status_pubsub, &status);
desktop->locked = false;
}
void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled) {
@@ -298,7 +306,7 @@ Desktop* desktop_alloc(void) {
desktop->lock_menu = desktop_lock_menu_alloc();
desktop->debug_view = desktop_debug_alloc();
desktop->hw_mismatch_popup = popup_alloc();
desktop->popup = popup_alloc();
desktop->locked_view = desktop_view_locked_alloc();
desktop->pin_input_view = desktop_view_pin_input_alloc();
desktop->pin_timeout_view = desktop_view_pin_timeout_alloc();
@@ -334,9 +342,7 @@ Desktop* desktop_alloc(void) {
view_dispatcher_add_view(
desktop->view_dispatcher, DesktopViewIdDebug, desktop_debug_get_view(desktop->debug_view));
view_dispatcher_add_view(
desktop->view_dispatcher,
DesktopViewIdHwMismatch,
popup_get_view(desktop->hw_mismatch_popup));
desktop->view_dispatcher, DesktopViewIdPopup, popup_get_view(desktop->popup));
view_dispatcher_add_view(
desktop->view_dispatcher,
DesktopViewIdPinTimeout,
@@ -476,6 +482,17 @@ int32_t desktop_srv(void* p) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneFault);
}
uint8_t keys_total, keys_valid;
if(!furi_hal_crypto_enclave_verify(&keys_total, &keys_valid)) {
FURI_LOG_E(
TAG,
"Secure Enclave verification failed: total %hhu, valid %hhu",
keys_total,
keys_valid);
scene_manager_next_scene(desktop->scene_manager, DesktopSceneSecureEnclave);
}
// Special case: autostart application is already running
if(loader_is_locked(desktop->loader) &&
animation_manager_is_animation_loaded(desktop->animation_manager)) {

View File

@@ -28,13 +28,19 @@ typedef enum {
DesktopViewIdLockMenu,
DesktopViewIdLocked,
DesktopViewIdDebug,
DesktopViewIdHwMismatch,
DesktopViewIdPopup,
DesktopViewIdPinInput,
DesktopViewIdPinTimeout,
DesktopViewIdSlideshow,
DesktopViewIdTotal,
} DesktopViewId;
typedef struct {
uint8_t hour;
uint8_t minute;
bool format_12; // 1 - 12 hour, 0 - 24H
} DesktopClock;
struct Desktop {
// Scene
FuriThread* scene_thread;
@@ -43,7 +49,7 @@ struct Desktop {
ViewDispatcher* view_dispatcher;
SceneManager* scene_manager;
Popup* hw_mismatch_popup;
Popup* popup;
DesktopLockMenuView* lock_menu;
DesktopDebugView* debug_view;
DesktopViewLocked* locked_view;
@@ -75,11 +81,10 @@ struct Desktop {
FuriPubSub* status_pubsub;
uint8_t time_hour;
uint8_t time_minute;
bool time_format_12 : 1; // 1 - 12 hour, 0 - 24H
DesktopClock clock;
bool in_transition : 1;
bool locked : 1;
FuriSemaphore* animation_semaphore;
};

View File

@@ -7,3 +7,4 @@ ADD_SCENE(desktop, locked, Locked)
ADD_SCENE(desktop, pin_input, PinInput)
ADD_SCENE(desktop, pin_timeout, PinTimeout)
ADD_SCENE(desktop, slideshow, Slideshow)
ADD_SCENE(desktop, secure_enclave, SecureEnclave)

View File

@@ -12,20 +12,21 @@ void desktop_scene_fault_callback(void* context) {
void desktop_scene_fault_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
Popup* popup = desktop->hw_mismatch_popup;
Popup* popup = desktop->popup;
popup_set_context(popup, desktop);
popup_set_header(
popup,
"Flipper crashed\n and was rebooted",
60,
64,
14 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
char* message = (char*)furi_hal_rtc_get_fault_data();
popup_set_text(popup, message, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_text(popup, message, 64, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_callback(popup, desktop_scene_fault_callback);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdHwMismatch);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdPopup);
}
bool desktop_scene_fault_on_event(void* context, SceneManagerEvent event) {
@@ -47,6 +48,11 @@ bool desktop_scene_fault_on_event(void* context, SceneManagerEvent event) {
}
void desktop_scene_fault_on_exit(void* context) {
UNUSED(context);
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->popup;
popup_reset(popup);
furi_hal_rtc_set_fault_data(0);
}

View File

@@ -4,17 +4,15 @@
#include "desktop_scene.h"
#include "../desktop_i.h"
#define HW_MISMATCH_BACK_EVENT (0UL)
void desktop_scene_hw_mismatch_callback(void* context) {
Desktop* desktop = (Desktop*)context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, HW_MISMATCH_BACK_EVENT);
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopHwMismatchExit);
}
void desktop_scene_hw_mismatch_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->hw_mismatch_popup;
Popup* popup = desktop->popup;
char* text_buffer = malloc(256);
scene_manager_set_scene_state(
@@ -28,10 +26,10 @@ void desktop_scene_hw_mismatch_on_enter(void* context) {
version_get_target(NULL));
popup_set_context(popup, desktop);
popup_set_header(
popup, "!!!! HW Mismatch !!!!", 60, 14 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_text(popup, text_buffer, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup, "!!!! HW Mismatch !!!!", 64, 12 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignBottom);
popup_set_text(popup, text_buffer, 64, 33 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_callback(popup, desktop_scene_hw_mismatch_callback);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdHwMismatch);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdPopup);
}
bool desktop_scene_hw_mismatch_on_event(void* context, SceneManagerEvent event) {
@@ -40,11 +38,10 @@ bool desktop_scene_hw_mismatch_on_event(void* context, SceneManagerEvent event)
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case HW_MISMATCH_BACK_EVENT:
case DesktopHwMismatchExit:
scene_manager_previous_scene(desktop->scene_manager);
consumed = true;
break;
default:
break;
}
@@ -55,11 +52,10 @@ bool desktop_scene_hw_mismatch_on_event(void* context, SceneManagerEvent event)
void desktop_scene_hw_mismatch_on_exit(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->hw_mismatch_popup;
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom);
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop);
popup_set_callback(popup, NULL);
popup_set_context(popup, NULL);
Popup* popup = desktop->popup;
popup_reset(popup);
char* text_buffer =
(char*)scene_manager_get_scene_state(desktop->scene_manager, DesktopSceneHwMismatch);
free(text_buffer);

View File

@@ -0,0 +1,57 @@
#include <gui/scene_manager.h>
#include <furi_hal.h>
#include "desktop_scene.h"
#include "../desktop_i.h"
void desktop_scene_secure_enclave_callback(void* context) {
Desktop* desktop = (Desktop*)context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopEnclaveExit);
}
void desktop_scene_secure_enclave_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->popup;
popup_set_context(popup, desktop);
popup_set_header(
popup, "No Factory Keys Found", 64, 12 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignBottom);
popup_set_text(
popup,
"Secure Enclave is damaged.\n"
"Some apps will not work.",
64,
33 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
popup_set_callback(popup, desktop_scene_secure_enclave_callback);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdPopup);
}
bool desktop_scene_secure_enclave_on_event(void* context, SceneManagerEvent event) {
Desktop* desktop = (Desktop*)context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DesktopEnclaveExit:
scene_manager_previous_scene(desktop->scene_manager);
consumed = true;
break;
default:
break;
}
}
return consumed;
}
void desktop_scene_secure_enclave_on_exit(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->popup;
popup_reset(popup);
}

View File

@@ -46,6 +46,10 @@ typedef enum {
DesktopSlideshowCompleted,
DesktopSlideshowPoweroff,
DesktopHwMismatchExit,
DesktopEnclaveExit,
// Global events
DesktopGlobalBeforeAppStarted,
DesktopGlobalAfterAppFinished,