1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 19:08:12 +00:00
trezor-firmware/mocks/trezor/msg.py

26 lines
650 B
Python
Raw Normal View History

2016-09-27 14:48:21 +00:00
2017-04-08 16:43:26 +00:00
# extmod/modtrezormsg/modtrezormsg.c
2017-06-12 16:02:32 +00:00
def init_usb(usb_info, usb_ifaces) -> None:
2016-09-27 14:48:21 +00:00
'''
2017-06-12 16:02:32 +00:00
Registers passed interfaces and initializes the USB stack
2016-09-27 14:48:21 +00:00
'''
2017-04-08 16:43:26 +00:00
# extmod/modtrezormsg/modtrezormsg.c
2017-06-12 16:02:32 +00:00
def deinit_usb() -> None:
'''
2017-06-12 16:02:32 +00:00
Cleans up the USB stack
'''
2017-04-08 16:43:26 +00:00
# extmod/modtrezormsg/modtrezormsg.c
2017-06-12 16:02:32 +00:00
def send(iface: int, message: bytes) -> int:
2016-09-27 14:48:21 +00:00
'''
Sends message using USB HID (device) or UDP (emulator).
'''
2017-04-08 16:43:26 +00:00
# extmod/modtrezormsg/modtrezormsg.c
2016-09-27 14:48:21 +00:00
def select(timeout_us: int) -> tuple:
'''
Polls the event queue and returns the event object.
Function returns None if timeout specified in microseconds is reached.
'''