1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-20 05:18:08 +00:00

main: unlock storage after boot

This commit is contained in:
Jan Pochyla 2017-10-24 13:59:09 +02:00 committed by Pavol Rusnak
parent 8288255048
commit a255938903
3 changed files with 30 additions and 5 deletions

27
src/boot.py Normal file
View File

@ -0,0 +1,27 @@
from trezor import config
from trezor import loop
from trezor import ui
from apps.common.request_pin import request_pin
async def unlock_layout():
while True:
if config.has_pin():
pin = await request_pin()
else:
pin = ''
if config.unlock(pin):
return
else:
await unlock_failed()
async def unlock_failed():
pass
config.init()
ui.display.backlight(ui.BACKLIGHT_DIM)
loop.schedule(unlock_layout())
loop.run()

View File

@ -1,12 +1,11 @@
from trezor import config
import boot
from trezor import io
from trezor import log
from trezor import loop
from trezor import wire
from trezor import workflow
config.init()
log.level = log.DEBUG
# initialize the USB stack
@ -102,7 +101,6 @@ usb.add(usb_vcp)
usb.add(usb_u2f)
# load applications
from apps.common import storage
if __debug__:
from apps import debug
from apps import homescreen

View File

@ -86,7 +86,7 @@ def run():
task_entry = [0, 0, 0] # deadline, task, value
msg_entry = [0, 0] # iface | flags, value
while True:
while _queue or _paused:
# compute the maximum amount of time we can wait for a message
if _queue:
delay = utime.ticks_diff(_queue.peektime(), utime.ticks_us())