1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-22 21:30:56 +00:00

core/sdcard: show "Wrong SD card" when unlocking SD protect with unformatted card

This commit is contained in:
matejcik 2020-03-05 12:58:09 +01:00 committed by matejcik
parent 3789a3372b
commit 3a71a5a05c

View File

@ -127,12 +127,12 @@ async def request_sd_salt(
await ensure_sdcard(ctx, ensure_filesystem=False) await ensure_sdcard(ctx, ensure_filesystem=False)
try: try:
return storage.sd_salt.load_sd_salt() return storage.sd_salt.load_sd_salt()
except storage.sd_salt.WrongSdCard: except (storage.sd_salt.WrongSdCard, fatfs.NoFilesystem):
if not await _wrong_card_dialog(ctx): if not await _wrong_card_dialog(ctx):
raise SdCardUnavailable("Wrong SD card.") raise SdCardUnavailable("Wrong SD card.")
except OSError: except OSError:
# Generic problem with loading the SD salt (either we could not read the # Generic problem with loading the SD salt (hardware problem, or we could
# file, or there is a staged salt which cannot be committed). # not read the file, or there is a staged salt which cannot be committed).
# In either case, there is no good way to recover. If the user clicks Retry, # In either case, there is no good way to recover. If the user clicks Retry,
# we will try again. # we will try again.
if not await sd_problem_dialog(ctx): if not await sd_problem_dialog(ctx):