mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 13:38:12 +00:00
src/apps/debug: use big if __debug__ block
This commit is contained in:
parent
9e16eb4122
commit
290643782a
@ -1,42 +1,41 @@
|
|||||||
from trezor import loop, utils
|
|
||||||
from trezor.messages import wire_types
|
|
||||||
from trezor.messages.DebugLinkState import DebugLinkState
|
|
||||||
from trezor.ui import confirm, swipe
|
|
||||||
from trezor.wire import register, protobuf_workflow
|
|
||||||
from apps.common import storage
|
|
||||||
|
|
||||||
if not __debug__:
|
if not __debug__:
|
||||||
utils.halt("debug mode inactive")
|
from trezor.utils import halt
|
||||||
|
halt("debug mode inactive")
|
||||||
|
|
||||||
reset_internal_entropy = None
|
if __debug__:
|
||||||
reset_current_words = None
|
from trezor import loop
|
||||||
reset_word_index = None
|
from trezor.messages import wire_types
|
||||||
|
from trezor.messages.DebugLinkState import DebugLinkState
|
||||||
|
from trezor.ui import confirm, swipe
|
||||||
|
from trezor.wire import register, protobuf_workflow
|
||||||
|
from apps.common import storage
|
||||||
|
|
||||||
confirm_signal = loop.signal()
|
reset_internal_entropy = None
|
||||||
swipe_signal = loop.signal()
|
reset_current_words = None
|
||||||
input_signal = loop.signal()
|
reset_word_index = None
|
||||||
|
|
||||||
|
confirm_signal = loop.signal()
|
||||||
|
swipe_signal = loop.signal()
|
||||||
|
input_signal = loop.signal()
|
||||||
|
|
||||||
async def dispatch_DebugLinkDecision(ctx, msg):
|
async def dispatch_DebugLinkDecision(ctx, msg):
|
||||||
if msg.yes_no is not None:
|
if msg.yes_no is not None:
|
||||||
confirm_signal.send(confirm.CONFIRMED if msg.yes_no else confirm.CANCELLED)
|
confirm_signal.send(confirm.CONFIRMED if msg.yes_no else confirm.CANCELLED)
|
||||||
if msg.up_down is not None:
|
if msg.up_down is not None:
|
||||||
swipe_signal.send(swipe.SWIPE_DOWN if msg.up_down else swipe.SWIPE_UP)
|
swipe_signal.send(swipe.SWIPE_DOWN if msg.up_down else swipe.SWIPE_UP)
|
||||||
if msg.input is not None:
|
if msg.input is not None:
|
||||||
input_signal.send(msg.input)
|
input_signal.send(msg.input)
|
||||||
|
|
||||||
|
async def dispatch_DebugLinkGetState(ctx, msg):
|
||||||
|
m = DebugLinkState()
|
||||||
|
m.mnemonic = storage.get_mnemonic()
|
||||||
|
m.passphrase_protection = storage.has_passphrase()
|
||||||
|
m.reset_word_pos = reset_word_index
|
||||||
|
m.reset_entropy = reset_internal_entropy
|
||||||
|
if reset_current_words:
|
||||||
|
m.reset_word = ' '.join(reset_current_words)
|
||||||
|
return m
|
||||||
|
|
||||||
async def dispatch_DebugLinkGetState(ctx, msg):
|
def boot():
|
||||||
m = DebugLinkState()
|
register(wire_types.DebugLinkDecision, protobuf_workflow, dispatch_DebugLinkDecision)
|
||||||
m.mnemonic = storage.get_mnemonic()
|
register(wire_types.DebugLinkGetState, protobuf_workflow, dispatch_DebugLinkGetState)
|
||||||
m.passphrase_protection = storage.has_passphrase()
|
|
||||||
m.reset_word_pos = reset_word_index
|
|
||||||
m.reset_entropy = reset_internal_entropy
|
|
||||||
if reset_current_words:
|
|
||||||
m.reset_word = ' '.join(reset_current_words)
|
|
||||||
return m
|
|
||||||
|
|
||||||
|
|
||||||
def boot():
|
|
||||||
register(wire_types.DebugLinkDecision, protobuf_workflow, dispatch_DebugLinkDecision)
|
|
||||||
register(wire_types.DebugLinkGetState, protobuf_workflow, dispatch_DebugLinkGetState)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user