async def respond_Features(ctx, msg): if msg.__qualname__ == 'Initialize': if msg.state is None or bytes(msg.state) != cache.get_state(state=bytes(msg.state)): cache.clear() f = Features() f.vendor = 'trezor.io' f.major_version = symbol('VERSION_MAJOR') f.minor_version = symbol('VERSION_MINOR') f.patch_version = symbol('VERSION_PATCH') f.device_id = storage.get_device_id() f.pin_protection = config.has_pin() f.passphrase_protection = storage.has_passphrase() f.language = 'english' f.label = storage.get_label() f.coins = coins.COINS f.initialized = storage.is_initialized() f.revision = symbol('GITREV') f.pin_cached = config.has_pin() f.passphrase_cached = cache.has_passphrase() f.needs_backup = storage.needs_backup() f.flags = storage.get_flags() if model() in ['T', 'EMU']: # emulator currently emulates model T f.model = 'T' return f
def get_features(): f = Features() f.vendor = 'trezor.io' f.language = 'english' f.major_version = utils.symbol('VERSION_MAJOR') f.minor_version = utils.symbol('VERSION_MINOR') f.patch_version = utils.symbol('VERSION_PATCH') f.revision = utils.symbol('GITREV') f.model = utils.model() if f.model == 'EMU': f.model = 'T' # emulator currently emulates model T f.device_id = storage.get_device_id() f.label = storage.get_label() f.initialized = storage.is_initialized() f.pin_protection = config.has_pin() f.pin_cached = config.has_pin() f.passphrase_protection = storage.has_passphrase() f.passphrase_cached = cache.has_passphrase() f.needs_backup = storage.needs_backup() f.unfinished_backup = storage.unfinished_backup() f.flags = storage.get_flags() return f
from trezor import io, loop, res, workflow from trezor.utils import model display = Display() # in debug mode, display an indicator in top right corner if __debug__: def debug_display_refresh(): display.bar(Display.WIDTH - 8, 0, 8, 8, 0xF800) display.refresh() loop.after_step_hook = debug_display_refresh # in both debug and production, emulator needs to draw the screen explicitly elif model() == "EMU": loop.after_step_hook = display.refresh # re-export constants from modtrezorui NORMAL = Display.FONT_NORMAL BOLD = Display.FONT_BOLD MONO = Display.FONT_MONO MONO_BOLD = Display.FONT_MONO_BOLD SIZE = Display.FONT_SIZE WIDTH = Display.WIDTH HEIGHT = Display.HEIGHT def lerpi(a: int, b: int, t: float) -> int: return int(a + t * (b - a))
from trezor import workflow from trezor.utils import model display = Display() # in debug mode, display an indicator in top right corner if __debug__: def debug_display_refresh(): display.bar(Display.WIDTH - 8, 0, 8, 8, 0xF800) display.refresh() loop.after_step_hook = debug_display_refresh # in both debug and production, emulator needs to draw the screen explicitly elif model() == 'EMU': loop.after_step_hook = display.refresh # import constants from modtrezorui SIZE = Display.FONT_SIZE NORMAL = Display.FONT_NORMAL BOLD = Display.FONT_BOLD MONO = Display.FONT_MONO WIDTH = Display.WIDTH HEIGHT = Display.HEIGHT def lerpi(a: int, b: int, t: float) -> int: return int(a + t * (b - a))