From 6783a06307dd3ef6249ed71f95512d9d17ad78d8 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 24 Jan 2019 11:39:24 +0100 Subject: [PATCH] accounts/usbwallet: add switch --- accounts/usbwallet/trezor.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accounts/usbwallet/trezor.go b/accounts/usbwallet/trezor.go index df947cc92f..82525a20cb 100644 --- a/accounts/usbwallet/trezor.go +++ b/accounts/usbwallet/trezor.go @@ -118,16 +118,16 @@ func (w *trezorDriver) Open(device io.ReadWriter, passphrase string) error { return err } // Only return the PIN request if the device wasn't unlocked until now - if res == 2 { - return nil // Device responded with trezor.Success - } - if res == 0 { + switch res { + case 0: w.pinwait = true return ErrTrezorPINNeeded - } else if res == 1 { + case 1: w.pinwait = false w.passphrasewait = true return ErrTrezorPassphraseNeeded + case 2: + return nil // responded with trezor.Success } } // Phase 2 requested with actual PIN entry