Skip to content

Commit 2fa0c94

Browse files
committed
keepkey, trezor: Handle if ButtonRequest is sent during sendpin
Keepkey is now displaying the passphrase to users after it receives it and responding with a ButtonRequest message. However this was not being properly handled by sendpin which would cause the device to hang as it waited for a ButtonAck. To resolve this, use self.call but avoid the firmware check which will fail due to the lack of self.features.
1 parent 8c1b50a commit 2fa0c94

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

hwilib/devices/trezor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def send_pin(self, pin: str) -> bool:
737737
raise DeviceAlreadyUnlockedError('The PIN has already been sent to this device')
738738
return False
739739
elif isinstance(resp, messages.PassphraseRequest):
740-
pass_resp = self.client.call_raw(messages.PassphraseAck(passphrase=self.client.ui.get_passphrase(available_on_device=False), on_device=False))
740+
pass_resp = self.client.call(messages.PassphraseAck(passphrase=self.client.ui.get_passphrase(available_on_device=False), on_device=False), check_fw=False)
741741
if isinstance(pass_resp, messages.Deprecated_PassphraseStateRequest):
742742
self.client.call_raw(messages.Deprecated_PassphraseStateAck())
743743
return True

hwilib/devices/trezorlib/client.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ def _callback_button(self, msg):
212212
return self._raw_read()
213213

214214
@tools.session
215-
def call(self, msg):
216-
self.check_firmware_version()
215+
def call(self, msg, check_fw = True):
216+
if check_fw:
217+
self.check_firmware_version()
217218
resp = self.call_raw(msg)
218219
while True:
219220
if isinstance(resp, messages.PinMatrixRequest):

0 commit comments

Comments
 (0)