2019-10-25 15:43:55 +00:00
|
|
|
import storage
|
|
|
|
import storage.device
|
|
|
|
import storage.sd_salt
|
2020-04-14 10:21:32 +00:00
|
|
|
from trezor import config, log, loop, ui, utils, wire
|
2020-03-16 22:40:39 +00:00
|
|
|
from trezor.pin import show_pin_timeout
|
2018-07-03 14:20:26 +00:00
|
|
|
|
2020-04-22 08:54:09 +00:00
|
|
|
from apps.common.request_pin import can_lock_device, verify_user_pin
|
2020-04-14 10:21:32 +00:00
|
|
|
from apps.homescreen.lockscreen import Lockscreen
|
2017-12-14 16:14:15 +00:00
|
|
|
|
|
|
|
|
2019-07-03 13:07:04 +00:00
|
|
|
async def bootscreen() -> None:
|
2020-06-02 13:23:11 +00:00
|
|
|
lockscreen = Lockscreen(bootscreen=True)
|
2019-10-25 15:43:55 +00:00
|
|
|
ui.display.orientation(storage.device.get_rotation())
|
2017-10-24 11:59:09 +00:00
|
|
|
while True:
|
2018-02-19 19:36:12 +00:00
|
|
|
try:
|
2020-04-22 08:54:09 +00:00
|
|
|
if can_lock_device():
|
2020-04-14 10:21:32 +00:00
|
|
|
await lockscreen
|
2020-03-16 22:40:39 +00:00
|
|
|
await verify_user_pin()
|
|
|
|
storage.init_unlocked()
|
|
|
|
return
|
2020-04-21 12:31:24 +00:00
|
|
|
except wire.PinCancelled:
|
2020-03-20 10:18:18 +00:00
|
|
|
# verify_user_pin will convert a SdCardUnavailable (in case of sd salt)
|
|
|
|
# to PinCancelled exception.
|
2020-04-21 12:31:24 +00:00
|
|
|
# Ignore exception, retry loop.
|
|
|
|
pass
|
2019-11-04 14:34:00 +00:00
|
|
|
except BaseException as e:
|
2020-03-20 10:18:18 +00:00
|
|
|
# other exceptions here are unexpected and should halt the device
|
2019-11-06 12:57:00 +00:00
|
|
|
if __debug__:
|
|
|
|
log.exception(__name__, e)
|
2019-10-17 15:56:09 +00:00
|
|
|
utils.halt(e.__class__.__name__)
|
2018-02-19 19:36:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
ui.display.backlight(ui.BACKLIGHT_NONE)
|
2019-05-13 13:06:34 +00:00
|
|
|
ui.backlight_fade(ui.BACKLIGHT_NORMAL)
|
2019-02-21 13:06:20 +00:00
|
|
|
config.init(show_pin_timeout)
|
2018-02-19 19:36:12 +00:00
|
|
|
loop.schedule(bootscreen())
|
2017-10-24 11:59:09 +00:00
|
|
|
loop.run()
|