Skip to content

Commit

Permalink
Latest Release RM0423-1246-0.101.1-bca8534 on PATREON - OFW PR 3615
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueMaster committed Apr 24, 2024
2 parents 88cfbb3 + 46d2d9b commit cd3b8ae
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 25 deletions.
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ This software is for experimental purposes only and is not meant for any illegal
- OFW: PR: [Fix the retry/exit confirmation prompts in iButton #3613 (By Astrrra)](https://github.com/flipperdevices/flipperzero-firmware/pull/3613)
- Updated: [Noptel LRF Sampler v1.5 (By Giraut)](https://github.com/Giraut/flipper_zero_noptel_lrf_sampler)
- Added: [Flight Assault v0.1 (By evillero)](https://github.com/evillero/flight_assault)
- OFW: PR: [Desktop: cleanup error popups #3615 (By skotopes)](https://github.com/flipperdevices/flipperzero-firmware/pull/3615)

<a name="release">

Expand Down
23 changes: 19 additions & 4 deletions applications/services/desktop/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ Desktop* desktop_alloc(void) {
desktop->view_dispatcher, desktop_back_event_callback);

desktop->lock_menu = desktop_lock_menu_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();
Expand Down Expand Up @@ -605,9 +605,7 @@ Desktop* desktop_alloc(void) {
DesktopViewIdLockMenu,
desktop_lock_menu_get_view(desktop->lock_menu));
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,
Expand Down Expand Up @@ -893,6 +891,23 @@ 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)) {
animation_manager_unload_and_stall_animation(desktop->animation_manager);
}

view_dispatcher_run(desktop->view_dispatcher);

furi_crash("That was unexpected");
Expand Down
4 changes: 2 additions & 2 deletions applications/services/desktop/desktop_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typedef enum {
DesktopViewIdMain,
DesktopViewIdLockMenu,
DesktopViewIdLocked,
DesktopViewIdHwMismatch,
DesktopViewIdPopup,
DesktopViewIdPinInput,
DesktopViewIdPinTimeout,
DesktopViewIdSlideshow,
Expand All @@ -45,7 +45,7 @@ struct Desktop {
ViewDispatcher* view_dispatcher;
SceneManager* scene_manager;

Popup* hw_mismatch_popup;
Popup* popup;
DesktopLockMenuView* lock_menu;
DesktopDebugView* _debug_view; // Unused, kept for compatibility
DesktopViewLocked* locked_view;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,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)
16 changes: 11 additions & 5 deletions applications/services/desktop/scenes/desktop_scene_fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
24 changes: 10 additions & 14 deletions applications/services/desktop/scenes/desktop_scene_hw_mismatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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) {
Expand All @@ -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;
}
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
4 changes: 4 additions & 0 deletions applications/services/desktop/views/desktop_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ typedef enum {
DesktopSlideshowCompleted,
DesktopSlideshowPoweroff,

DesktopHwMismatchExit,

DesktopEnclaveExit,

// Global events
DesktopGlobalBeforeAppStarted,
DesktopGlobalAfterAppFinished,
Expand Down

0 comments on commit cd3b8ae

Please sign in to comment.