From 6c14ee7ec02ee625fa127cd2fc94097125a0d76f Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 24 Sep 2019 19:02:46 +0000 Subject: [PATCH] core: initialize fatfs only after we know the SD card is powered --- core/src/apps/common/sd_salt.py | 3 ++- core/src/boot.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/apps/common/sd_salt.py b/core/src/apps/common/sd_salt.py index 7ca016a321..0c848d7756 100644 --- a/core/src/apps/common/sd_salt.py +++ b/core/src/apps/common/sd_salt.py @@ -116,11 +116,12 @@ async def set_sd_salt( salt_path = "%s/%s" % (device_dir, filename) sd = io.SDCard() - fs = io.FatFS() if not sd.power(True): await insert_card_dialog(ctx) raise SdProtectCancelled + fs = io.FatFS() + try: fs.mount() fs.mkdir("/trezor", True) diff --git a/core/src/boot.py b/core/src/boot.py index a9f48d6ad3..4c3214e3d2 100644 --- a/core/src/boot.py +++ b/core/src/boot.py @@ -75,8 +75,8 @@ async def lockscreen() -> None: if utils.EMULATOR: # Ensure the emulated SD card is FAT32 formatted. sd = io.SDCard() - fs = io.FatFS() sd.power(True) + fs = io.FatFS() try: fs.mount() except OSError: