python: fix behavior of client.ping() when device is locked

pull/1173/head
matejcik 4 years ago
parent 3dd3d96957
commit 769ccf52c6

@ -28,6 +28,7 @@ _At the moment, the project does **not** adhere to [Semantic Versioning](https:/
- correctly calculate hashes for very small firmwares [f#1082]
- unified file arguments in trezorctl
- `TrezorClient.ping()` does not crash when device is PIN-locked
## [0.12.0] - 2020-04-01
[0.12.0]: https://github.com/trezor/trezor-firmware/compare/python/v0.11.6...python/v0.12.0

@ -331,7 +331,12 @@ class TrezorClient:
# XXX this should be: `with self:`
try:
self.open()
return self.call_raw(messages.Ping(message=msg))
resp = self.call_raw(messages.Ping(message=msg))
if isinstance(resp, messages.ButtonRequest):
# device is PIN-locked.
# respond and hope for the best
resp = self._callback_button(resp)
return resp
finally:
self.close()

Loading…
Cancel
Save