diff --git a/python/src/trezorlib/cli/trezorctl.py b/python/src/trezorlib/cli/trezorctl.py index 0ad7152418..da784a5a6b 100755 --- a/python/src/trezorlib/cli/trezorctl.py +++ b/python/src/trezorlib/cli/trezorctl.py @@ -337,9 +337,7 @@ def ping(session: "Session", message: str, button_protection: bool) -> str: """Send ping message.""" # TODO return short-circuit from old client for old Trezors - return session.call( - messages.Ping(message=message, button_protection=button_protection) - ) + return session.ping(message, button_protection) @cli.command() diff --git a/python/src/trezorlib/transport/session.py b/python/src/trezorlib/transport/session.py index f8441c0fc7..7ba6535801 100644 --- a/python/src/trezorlib/transport/session.py +++ b/python/src/trezorlib/transport/session.py @@ -73,6 +73,12 @@ class Session: def end(self) -> t.Any: return self.call(messages.EndSession()) + def ping(self, message: str, button_protection: bool | None = None) -> str: + resp: messages.Success = self.call( + messages.Ping(message=message, button_protection=button_protection) + ) + return resp.message or "" + @property def features(self) -> messages.Features: return self.client.features