diff --git a/src/apps/homescreen/layout_homescreen.py b/src/apps/homescreen/layout_homescreen.py index 773353b325..98d2274e4f 100644 --- a/src/apps/homescreen/layout_homescreen.py +++ b/src/apps/homescreen/layout_homescreen.py @@ -4,7 +4,7 @@ from trezor.utils import unimport_gen from trezor.res import loadres from trezor import dispatcher from trezor import loop -from trezor import msg +from trezor import wire def swipe_to_rotate(): @@ -39,7 +39,7 @@ def layout_homescreen(initialize_msg=None): features.passphrase_cached = False features.passphrase_protection = False features.vendor = 'bitcointrezor.com' - msg.write_msg(features) + wire.write_msg(features) yield loop.Wait([dispatcher.dispatch(), swipe_to_rotate(), animate_logo()]) diff --git a/src/apps/wallet/layout_get_public_key.py b/src/apps/wallet/layout_get_public_key.py index ef799a26c6..1a3fb5a306 100644 --- a/src/apps/wallet/layout_get_public_key.py +++ b/src/apps/wallet/layout_get_public_key.py @@ -1,4 +1,4 @@ -from trezor import msg +from trezor import wire from trezor import ui from trezor.ui.button import Button, CONFIRM_BUTTON, CONFIRM_BUTTON_ACTIVE from trezor.ui.pin import PinDialog @@ -23,4 +23,4 @@ def layout_get_public_key(message): pubkey.node.fingerprint = 0 pubkey.node.chain_code = 'deadbeef' pubkey.node.public_key = 'deadbeef' - msg.write_msg(pubkey) + wire.write_msg(pubkey) diff --git a/src/trezor/dispatcher.py b/src/trezor/dispatcher.py index e7ede09a6f..b3e181e5c5 100644 --- a/src/trezor/dispatcher.py +++ b/src/trezor/dispatcher.py @@ -1,4 +1,4 @@ -from . import msg +from . import wire from . import layout @@ -15,6 +15,6 @@ def unregister(message_type): def dispatch(): mtypes = message_handlers.keys() - message = yield from msg.read_msg(*mtypes) + message = yield from wire.read_msg(*mtypes) handler = message_handlers[message.message_type] layout.change(handler(message)) diff --git a/src/trezor/loop.py b/src/trezor/loop.py index 59a566a37b..23f0b37562 100644 --- a/src/trezor/loop.py +++ b/src/trezor/loop.py @@ -16,7 +16,7 @@ if __debug__: TOUCH = const(256) # 0-255 is reserved for USB interfaces TOUCH_START = const(1) TOUCH_MOVE = const(2) -TOUCH_END = const(3) +TOUCH_END = const(4) msg_handlers = {} # Interface -> generator time_queue = [] @@ -138,8 +138,7 @@ def run_forever(): message = msg.select(delay) if message: # Run interrupt handler right away, they have priority - iface = message[0] - data = message + iface, *data = message gen = msg_handlers.pop(iface, None) if not gen: log.info(__name__, 'No handler for message: %s', iface) diff --git a/src/trezor/ui/button.py b/src/trezor/ui/button.py index ab2c0968ce..b7e33a131c 100644 --- a/src/trezor/ui/button.py +++ b/src/trezor/ui/button.py @@ -96,9 +96,7 @@ class Button(): def wait(self): while True: self.render() - event, *pos = yield loop.Select(loop.TOUCH_START, - loop.TOUCH_MOVE, - loop.TOUCH_END) + event, *pos = yield loop.Select(loop.TOUCH) result = self.send(event, pos) if result is not None: return result diff --git a/src/trezor/ui/swipe.py b/src/trezor/ui/swipe.py index d8eac86dd5..e0ae1175a0 100644 --- a/src/trezor/ui/swipe.py +++ b/src/trezor/ui/swipe.py @@ -65,7 +65,7 @@ class Swipe(): def wait(self): while True: - event, *pos = yield loop.Select(loop.TOUCH_START, loop.TOUCH_END) + event, *pos = yield loop.Select(loop.TOUCH) result = self.send(event, pos) if result is not None: return result diff --git a/src/trezor/wire.py b/src/trezor/wire.py index 78d9a9f072..539e98d993 100644 --- a/src/trezor/wire.py +++ b/src/trezor/wire.py @@ -10,7 +10,7 @@ HEADER_MAGIC = const(35) # def read_report(): - _, rep = yield loop.Select(IFACE) + rep, = yield loop.Select(IFACE) assert rep[0] == REPORT_NUM, 'Report number malformed' return rep