1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00

apps.homescreen: respond with ~correct data, handle GetFeatures

This commit is contained in:
Jan Pochyla 2016-10-20 15:12:25 +02:00
parent ad2955aaab
commit 67ac47f087

View File

@ -1,29 +1,30 @@
from trezor.wire import register_type, protobuf_handler, write_message
from trezor.utils import unimport
from trezor.messages.wire_types import Initialize
from trezor.messages.wire_types import Initialize, GetFeatures
@unimport
async def dispatch_Initialize(_, session_id):
async def respond(_, session_id):
from ..common import storage
from trezor.messages.Features import Features
features = Features(
revision='deadbeef',
bootloader_hash='deadbeef',
device_id='DEADBEEF',
coins=[],
imported=False,
initialized=False,
label='My TREZOR',
major_version=2,
minor_version=0,
patch_version=0,
pin_cached=False,
pin_protection=True,
passphrase_cached=False,
passphrase_protection=False,
vendor='bitcointrezor.com')
await write_message(session_id, features)
f = Features()
f.vendor = 'bitcointrezor.com'
f.revision = '0123456789'
f.bootloader_hash = '0123456789'
f.major_version = 2
f.minor_version = 0
f.patch_version = 0
f.coins = []
f.device_id = storage.get_device_id()
f.label = storage.get_label()
f.initialized = storage.is_initialized()
f.pin_protection = storage.is_protected_by_pin()
f.passphrase_protection = storage.is_protected_by_passphrase()
await write_message(session_id, f)
def boot():
register_type(Initialize, protobuf_handler, dispatch_Initialize)
register_type(Initialize, protobuf_handler, respond)
register_type(GetFeatures, protobuf_handler, respond)