1
0

trezor: minor things for better model "safe 3" support

This commit is contained in:
SomberNight
2024-02-14 09:48:13 +00:00
parent fffbc178cd
commit 6172898a03
2 changed files with 18 additions and 7 deletions

View File

@@ -203,7 +203,7 @@ class TrezorClientBase(HardwareClientBase, Logger):
return self.client.version >= self.plugin.minimum_firmware
def get_trezor_model(self):
"""Returns '1' for Trezor One, 'T' for Trezor T."""
"""Returns '1' for Trezor One, 'T' for Trezor T, etc."""
return self.features.model
def device_model_name(self):
@@ -212,6 +212,8 @@ class TrezorClientBase(HardwareClientBase, Logger):
return "Trezor One"
elif model == 'T':
return "Trezor T"
elif model == "Safe 3":
return "Trezor Safe 3"
return None
@runs_in_hwd_thread
@@ -290,10 +292,12 @@ class TrezorClientBase(HardwareClientBase, Logger):
# check PIN length. Depends on model and firmware version
# https://github.com/trezor/trezor-firmware/issues/1167
limit = 9
if self.features.model == "1" and (1, 10, 0) <= self.client.version:
limit = 50
elif self.features.model == "T" and (2, 4, 0) <= self.client.version:
limit = 50
if self.get_trezor_model() == "1":
if (1, 10, 0) <= self.client.version:
limit = 50
else:
if (2, 4, 0) <= self.client.version:
limit = 50
if len(pin) > limit:
self.handler.show_error(_('The PIN cannot be longer than {} characters.').format(limit))
raise Cancelled

View File

@@ -425,8 +425,15 @@ class InitSettingsLayout(QVBoxLayout):
if method == TIM_NEW:
self.cb_no_backup = QCheckBox(_('Enable seedless mode'))
self.cb_no_backup.setChecked(False)
if (model == '1' and fw_version >= (1, 7, 1)
or model == 'T' and fw_version >= (2, 0, 9)):
supports_no_backup = False
if model == '1':
if fw_version >= (1, 7, 1):
supports_no_backup = True
else:
if fw_version >= (2, 0, 9):
supports_no_backup = True
if supports_no_backup:
self.cb_no_backup.setEnabled(True)
self.cb_no_backup.setToolTip(SEEDLESS_MODE_WARNING)
else:
self.cb_no_backup.setEnabled(False)