From 4d167f4961ebb942e1351be66fca9669391a737c Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sat, 12 Nov 2016 15:13:00 +0100 Subject: [PATCH] apps.homescreen: handle Ping message --- src/apps/homescreen/__init__.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/apps/homescreen/__init__.py b/src/apps/homescreen/__init__.py index dfdbdb46a4..43ba146a37 100644 --- a/src/apps/homescreen/__init__.py +++ b/src/apps/homescreen/__init__.py @@ -1,9 +1,9 @@ from trezor.wire import register_type, protobuf_handler, write_message from trezor.utils import unimport -from trezor.messages.wire_types import Initialize, GetFeatures +from trezor.messages.wire_types import Initialize, GetFeatures, Ping -async def respond(_, session_id): +async def respond_Features(_, session_id): from ..common import storage, coins from trezor.messages.Features import Features @@ -25,6 +25,18 @@ async def respond(_, session_id): await write_message(session_id, f) +async def respond_Pong(ping, session_id): + from trezor.messages.Success import Success + + # TODO: handle button_protection, passphrase_protection and pin_protection flags of Ping message + + f = Success() + f.message = ping.message + + await write_message(session_id, f) + + def boot(): - register_type(Initialize, protobuf_handler, respond) - register_type(GetFeatures, protobuf_handler, respond) + register_type(Initialize, protobuf_handler, respond_Features) + register_type(GetFeatures, protobuf_handler, respond_Features) + register_type(Ping, protobuf_handler, respond_Pong)