Browse Source

don't use internal cmdtr module in trezor plugin

master
Pavol Rusnak 12 years ago committed by m0mchil
parent
commit
bb78873e24
  1. 8
      plugins/trezor.py

8
plugins/trezor.py

@ -14,11 +14,11 @@ from lib.wallet import NewWallet
try: try:
import cmdtr
from trezorlib.client import types from trezorlib.client import types
from trezorlib.client import proto, BaseClient, ProtocolMixin from trezorlib.client import proto, BaseClient, ProtocolMixin
from trezorlib.qt.pinmatrix import PinMatrixWidget from trezorlib.qt.pinmatrix import PinMatrixWidget
from trezorlib.transport import ConnectionError from trezorlib.transport import ConnectionError
from trezorlib.transport_hid import HidTransport
TREZOR = True TREZOR = True
except ImportError: except ImportError:
TREZOR = False TREZOR = False
@ -117,7 +117,11 @@ class TrezorWallet(NewWallet):
raise Exception('please install github.com/trezor/python-trezor') raise Exception('please install github.com/trezor/python-trezor')
if not self.client or self.client.bad: if not self.client or self.client.bad:
self.transport = cmdtr.get_transport('usb', '') try:
d = HidTransport.enumerate()[0]
self.transport = HidTransport(d)
except:
raise Exception("Trezor not found")
self.client = QtGuiTrezorClient(self.transport) self.client = QtGuiTrezorClient(self.transport)
self.client.set_tx_api(self) self.client.set_tx_api(self)
#self.client.clear_session()# TODO Doesn't work with firmware 1.1, returns proto.Failure #self.client.clear_session()# TODO Doesn't work with firmware 1.1, returns proto.Failure

Loading…
Cancel
Save