1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-20 21:38:26 +00:00

client: do not coerce self.features.vendor to string

There is no good reason to do that and it hides situations when
the field mistakenly doesn't exist.

Added comment explains that missing "vendor" field might by caused
by trezor-common mismatch, which fixes #328
This commit is contained in:
matejcik 2018-11-06 14:13:08 +01:00
parent ca345e9766
commit 560a5215c5

View File

@ -180,8 +180,11 @@ class ProtocolMixin(object):
raise exceptions.TrezorException("Unexpected initial response") raise exceptions.TrezorException("Unexpected initial response")
else: else:
self.features = resp self.features = resp
if str(self.features.vendor) not in self.VENDORS: if self.features.vendor not in self.VENDORS:
raise RuntimeError("Unsupported device") raise RuntimeError("Unsupported device")
# A side-effect of this is a sanity check for broken protobuf definitions.
# If the `vendor` field doesn't exist, you probably have a mismatched
# checkout of trezor-common.
@staticmethod @staticmethod
def expand_path(n): def expand_path(n):