From e9d498e77a08b3b63c4f212defe42bbfeef4a06f Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Sat, 12 Jan 2019 17:12:08 -0500 Subject: [PATCH] Check that flash device is selected for blackbox before msc CLI reboot Previously the logic would only validate whether one or more of the defined flash device types was ready and not examine the user selected blackbox device. Then on reboot during `mscStart()` the logic there would use the selected blackbox device type to decide which mode to operate in. If a flash device wasn't selected the msc initialization failed (like if serial port or "no logging" were selected). This change only checks the status of the selected blackbox device to ensure that a reboot will properly start mass storage mode. --- src/main/io/usb_msc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/io/usb_msc.c b/src/main/io/usb_msc.c index adb67e174..524f40f79 100644 --- a/src/main/io/usb_msc.c +++ b/src/main/io/usb_msc.c @@ -22,6 +22,8 @@ #include "platform.h" +#include "blackbox/blackbox.h" + #include "drivers/sdcard.h" #include "io/flashfs.h" @@ -32,10 +34,10 @@ bool mscCheckFilesystemReady(void) { return false #if defined(USE_SDCARD) - || sdcard_isFunctional() + || (blackboxConfig()->device == BLACKBOX_DEVICE_SDCARD && sdcard_isFunctional()) #endif #if defined(USE_FLASHFS) - || flashfsGetSize() > 0 + || (blackboxConfig()->device == BLACKBOX_DEVICE_FLASH && flashfsGetSize() > 0) #endif ; }