1
0
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:
Pavol Rusnak 2018-06-06 00:37:20 +02:00
parent 9e16eb4122
commit 290643782a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -1,23 +1,24 @@
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:
@ -25,8 +26,7 @@ async def dispatch_DebugLinkDecision(ctx, msg):
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):
async def dispatch_DebugLinkGetState(ctx, msg):
m = DebugLinkState() m = DebugLinkState()
m.mnemonic = storage.get_mnemonic() m.mnemonic = storage.get_mnemonic()
m.passphrase_protection = storage.has_passphrase() m.passphrase_protection = storage.has_passphrase()
@ -36,7 +36,6 @@ async def dispatch_DebugLinkGetState(ctx, msg):
m.reset_word = ' '.join(reset_current_words) m.reset_word = ' '.join(reset_current_words)
return m return m
def boot():
def boot():
register(wire_types.DebugLinkDecision, protobuf_workflow, dispatch_DebugLinkDecision) register(wire_types.DebugLinkDecision, protobuf_workflow, dispatch_DebugLinkDecision)
register(wire_types.DebugLinkGetState, protobuf_workflow, dispatch_DebugLinkGetState) register(wire_types.DebugLinkGetState, protobuf_workflow, dispatch_DebugLinkGetState)