mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-23 21:02:23 +00:00
wip trezorlib wait-for-emulator to new UdpTransport
This commit is contained in:
parent
9942f06b11
commit
28f25b6130
@ -29,7 +29,7 @@ from ..client import TrezorClient
|
|||||||
from ..transport import DeviceIsBusy, new_enumerate_devices
|
from ..transport import DeviceIsBusy, new_enumerate_devices
|
||||||
from ..transport.new import channel_database
|
from ..transport.new import channel_database
|
||||||
from ..transport.new.client import NewTrezorClient
|
from ..transport.new.client import NewTrezorClient
|
||||||
from ..transport.udp import UdpTransport
|
from ..transport.new.udp import UdpTransport
|
||||||
from . import (
|
from . import (
|
||||||
AliasedGroup,
|
AliasedGroup,
|
||||||
NewTrezorConnection,
|
NewTrezorConnection,
|
||||||
@ -404,7 +404,7 @@ def usb_reset() -> None:
|
|||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("-t", "--timeout", type=float, default=10, help="Timeout in seconds")
|
@click.option("-t", "--timeout", type=float, default=10, help="Timeout in seconds")
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def wait_for_emulator(obj: TrezorConnection, timeout: float) -> None:
|
def wait_for_emulator(obj: NewTrezorConnection, timeout: float) -> None:
|
||||||
"""Wait until Trezor Emulator comes up.
|
"""Wait until Trezor Emulator comes up.
|
||||||
|
|
||||||
Tries to connect to emulator and returns when it succeeds.
|
Tries to connect to emulator and returns when it succeeds.
|
||||||
@ -416,7 +416,7 @@ def wait_for_emulator(obj: TrezorConnection, timeout: float) -> None:
|
|||||||
path = path.replace("udp:", "")
|
path = path.replace("udp:", "")
|
||||||
|
|
||||||
start = time.monotonic()
|
start = time.monotonic()
|
||||||
UdpTransport(path, skip_protocol_detection=True).wait_until_ready(timeout)
|
UdpTransport(path).wait_until_ready(timeout)
|
||||||
end = time.monotonic()
|
end = time.monotonic()
|
||||||
|
|
||||||
LOG.info(f"Waited for {end - start:.3f} seconds")
|
LOG.info(f"Waited for {end - start:.3f} seconds")
|
||||||
|
Loading…
Reference in New Issue
Block a user