mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 07:18:09 +00:00
main: unlock storage after boot
This commit is contained in:
parent
8288255048
commit
a255938903
27
src/boot.py
Normal file
27
src/boot.py
Normal 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()
|
@ -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
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user