From f7f04b0482c64069e2ae4878b377e65b8ee33c7e Mon Sep 17 00:00:00 2001 From: slush0 Date: Mon, 7 Oct 2013 23:27:56 +0200 Subject: [PATCH] Introduce pin_input message to trigger PinMatrix widget --- trezorlib/client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/trezorlib/client.py b/trezorlib/client.py index 6f44ac6280..fab17c900a 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -11,6 +11,9 @@ def show_input(input_text, message=None): print "QUESTION FROM DEVICE:", message return raw_input(input_text) +def pin_func(input_text, message=None): + return show_input(input_text, message) + class CallException(Exception): pass @@ -20,12 +23,13 @@ class PinException(CallException): class TrezorClient(object): def __init__(self, transport, debuglink=None, - message_func=show_message, input_func=show_input, debug=False): + message_func=show_message, input_func=show_input, pin_func=pin_func, debug=False): self.transport = transport self.debuglink = debuglink self.message_func = message_func self.input_func = input_func + self.pin_func = pin_func self.debug = debug self.setup_debuglink() @@ -104,7 +108,7 @@ class TrezorClient(object): else: msg2 = proto.PinMatrixAck(pin='444444222222') else: - pin = self.input_func("PIN required: ", resp.message) + pin = self.pin_func("PIN required: ", resp.message) msg2 = proto.PinMatrixAck(pin=pin) return self.call(msg2)