summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/main.c3
-rw-r--r--apps/misc.c12
-rw-r--r--apps/misc.h3
-rw-r--r--firmware/export/config-sim.h1
4 files changed, 16 insertions, 3 deletions
diff --git a/apps/main.c b/apps/main.c
index 145153ba37..3e98343708 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -622,6 +622,9 @@ static void init(void)
#ifdef HAVE_ACCESSORY_SUPPLY
accessory_supply_set(global_settings.accessory_supply);
#endif
+#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
+ check_bootfile(false); /* remember write time and filesize */
+#endif
}
#ifdef CPU_PP
diff --git a/apps/misc.c b/apps/misc.c
index 6677c5f9b9..307592e346 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -79,7 +79,8 @@
#include "playback.h"
#ifdef BOOTFILE
-#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF)
+#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) \
+ || defined(HAVE_HOTSWAP_STORAGE_AS_MAIN)
#include "rolo.h"
#endif
#endif
@@ -606,6 +607,13 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
audio_resume();
return SYS_CAR_ADAPTER_RESUME;
#endif
+#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
+ case SYS_FS_CHANGED:
+ system_flush();
+ check_bootfile(true); /* state gotten in main.c:init() */
+ system_restore();
+ return SYS_FS_CHANGED;
+#endif
#ifdef HAVE_HEADPHONE_DETECTION
case SYS_PHONE_PLUGGED:
unplug_change(true);
@@ -682,7 +690,7 @@ int show_logo( void )
}
#ifdef BOOTFILE
-#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF)
+#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) || defined(HAVE_HOTSWAP_STORAGE_AS_MAIN)
/*
memorize/compare details about the BOOTFILE
we don't use dircache because it may not be up to date after
diff --git a/apps/misc.h b/apps/misc.h
index 857d9ab4da..34f754bda3 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -69,7 +69,8 @@ extern int show_logo(void);
int open_utf8(const char* pathname, int flags);
#ifdef BOOTFILE
-#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF)
+#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) \
+ || defined(HAVE_HOTSWAP_STORAGE_AS_MAIN)
void check_bootfile(bool do_rolo);
#endif
#endif
diff --git a/firmware/export/config-sim.h b/firmware/export/config-sim.h
index 0656da3ac4..ec398c8b2d 100644
--- a/firmware/export/config-sim.h
+++ b/firmware/export/config-sim.h
@@ -32,6 +32,7 @@
#undef HAVE_MULTIDRIVE
#undef NUM_DRIVES
#undef HAVE_HOTSWAP
+#undef HAVE_HOTSWAP_STORAGE_AS_MAIN
#undef CONFIG_STORAGE