mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 07:18:09 +00:00
protob: regenerate, fix using old failure codes
This commit is contained in:
parent
e33f4d7612
commit
de2f9e7c14
12
trezorctl
12
trezorctl
@ -89,7 +89,7 @@ def get_transport(transport_string, path, **kwargs):
|
|||||||
if path == '' or path in d:
|
if path == '' or path in d:
|
||||||
return HidTransport(d, **kwargs)
|
return HidTransport(d, **kwargs)
|
||||||
|
|
||||||
raise CallException(types.Failure_Other, "Device not found")
|
raise CallException(types.Failure_NotInitialized, "Device not found")
|
||||||
|
|
||||||
if transport_string == 'udp':
|
if transport_string == 'udp':
|
||||||
from trezorlib.transport_udp import UdpTransport
|
from trezorlib.transport_udp import UdpTransport
|
||||||
@ -109,7 +109,7 @@ def get_transport(transport_string, path, **kwargs):
|
|||||||
if path == '' or d['path'] == binascii.hexlify(path):
|
if path == '' or d['path'] == binascii.hexlify(path):
|
||||||
return BridgeTransport(d, **kwargs)
|
return BridgeTransport(d, **kwargs)
|
||||||
|
|
||||||
raise CallException(types.Failure_Other, "Device not found")
|
raise CallException(types.Failure_NotInitialized, "Device not found")
|
||||||
|
|
||||||
raise NotImplementedError("Unknown transport")
|
raise NotImplementedError("Unknown transport")
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class Commands(object):
|
|||||||
if ' ' in value:
|
if ' ' in value:
|
||||||
value, unit = value.split(' ', 1)
|
value, unit = value.split(' ', 1)
|
||||||
if unit.lower() not in ether_units:
|
if unit.lower() not in ether_units:
|
||||||
raise CallException(types.Failure_Other, "Unrecognized ether unit %r" % unit)
|
raise CallException(types.Failure_DataError, "Unrecognized ether unit %r" % unit)
|
||||||
value = int(value) * ether_units[unit.lower()]
|
value = int(value) * ether_units[unit.lower()]
|
||||||
else:
|
else:
|
||||||
value = int(value)
|
value = int(value)
|
||||||
@ -157,7 +157,7 @@ class Commands(object):
|
|||||||
if ' ' in gas_price:
|
if ' ' in gas_price:
|
||||||
gas_price, unit = gas_price.split(' ', 1)
|
gas_price, unit = gas_price.split(' ', 1)
|
||||||
if unit.lower() not in ether_units:
|
if unit.lower() not in ether_units:
|
||||||
raise CallException(types.Failure_Other, "Unrecognized gas price unit %r" % unit)
|
raise CallException(types.Failure_DataError, "Unrecognized gas price unit %r" % unit)
|
||||||
gas_price = int(gas_price) * ether_units[unit.lower()]
|
gas_price = int(gas_price) * ether_units[unit.lower()]
|
||||||
else:
|
else:
|
||||||
gas_price = int(gas_price)
|
gas_price = int(gas_price)
|
||||||
@ -251,7 +251,7 @@ class Commands(object):
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
im = Image.open(args.filename)
|
im = Image.open(args.filename)
|
||||||
if im.size != (128, 64):
|
if im.size != (128, 64):
|
||||||
raise CallException(types.Failure_Other, 'Wrong size of the image')
|
raise CallException(types.Failure_DataError, 'Wrong size of the image')
|
||||||
im = im.convert('1')
|
im = im.convert('1')
|
||||||
pix = im.load()
|
pix = im.load()
|
||||||
img = ''
|
img = ''
|
||||||
@ -281,7 +281,7 @@ class Commands(object):
|
|||||||
|
|
||||||
def load_device(self, args):
|
def load_device(self, args):
|
||||||
if not args.mnemonic and not args.xprv:
|
if not args.mnemonic and not args.xprv:
|
||||||
raise CallException(types.Failure_Other, "Please provide mnemonic or xprv")
|
raise CallException(types.Failure_DataError, "Please provide mnemonic or xprv")
|
||||||
|
|
||||||
if args.mnemonic:
|
if args.mnemonic:
|
||||||
mnemonic = ' '.join(args.mnemonic)
|
mnemonic = ' '.join(args.mnemonic)
|
||||||
|
@ -380,17 +380,17 @@ class DebugLinkMixin(object):
|
|||||||
try:
|
try:
|
||||||
expected = self.expected_responses.pop(0)
|
expected = self.expected_responses.pop(0)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise CallException(types.Failure_Other,
|
raise CallException(types.Failure_UnexpectedMessage,
|
||||||
"Got %s, but no message has been expected" % pprint(msg))
|
"Got %s, but no message has been expected" % pprint(msg))
|
||||||
|
|
||||||
if msg.__class__ != expected.__class__:
|
if msg.__class__ != expected.__class__:
|
||||||
raise CallException(types.Failure_Other,
|
raise CallException(types.Failure_UnexpectedMessage,
|
||||||
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
||||||
|
|
||||||
fields = expected.ListFields() # only filled (including extensions)
|
fields = expected.ListFields() # only filled (including extensions)
|
||||||
for field, value in fields:
|
for field, value in fields:
|
||||||
if not msg.HasField(field.name) or getattr(msg, field.name) != value:
|
if not msg.HasField(field.name) or getattr(msg, field.name) != value:
|
||||||
raise CallException(types.Failure_Other,
|
raise CallException(types.Failure_UnexpectedMessage,
|
||||||
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
||||||
|
|
||||||
def callback_ButtonRequest(self, msg):
|
def callback_ButtonRequest(self, msg):
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user