1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-21 12:02:19 +00:00

chore(core): include T3B1 where relevant

also convert "INTERNAL_MODEL in (tuple)" to equality comparisons, see
previous commit

[no changelog]
This commit is contained in:
matejcik 2024-08-27 12:21:40 +02:00 committed by matejcik
parent 43677c6afd
commit afb75892f2
9 changed files with 42 additions and 16 deletions

View File

@ -93,7 +93,11 @@ def get_features() -> Features:
bootloader_locked=utils.bootloader_locked(), bootloader_locked=utils.bootloader_locked(),
) )
if utils.INTERNAL_MODEL in ("T1B1", "T2B1"): if (
utils.INTERNAL_MODEL == "T1B1" # pylint: disable=consider-using-in
or utils.INTERNAL_MODEL == "T2B1"
or utils.INTERNAL_MODEL == "T3B1"
):
f.homescreen_format = HomescreenFormat.ToiG f.homescreen_format = HomescreenFormat.ToiG
else: else:
f.homescreen_format = HomescreenFormat.Jpeg f.homescreen_format = HomescreenFormat.Jpeg

View File

@ -100,8 +100,14 @@ async def confirm_output(
if output.address_n and not output.multisig: if output.address_n and not output.multisig:
from trezor import utils from trezor import utils
# Showing the account string only for T2B1 model # Showing the account string only for model_tr layout
show_account_str = utils.INTERNAL_MODEL == "T2B1" # TODO expose layout_type so that we can check for it, instead of listing
# all models that use the layout?
show_account_str = (
# pylint: disable-next=consider-using-in
utils.INTERNAL_MODEL == "T2B1"
or utils.INTERNAL_MODEL == "T3B1"
)
script_type = CHANGE_OUTPUT_TO_INPUT_SCRIPT_TYPES[output.script_type] script_type = CHANGE_OUTPUT_TO_INPUT_SCRIPT_TYPES[output.script_type]
address_label = ( address_label = (
address_n_to_name( address_n_to_name(

View File

@ -178,11 +178,16 @@ if __debug__:
if ( if (
x is not None x is not None
and y is not None and y is not None
and utils.INTERNAL_MODEL in ("T2T1", "T3T1", "D001") and utils.INTERNAL_MODEL # pylint: disable=internal-model-tuple-comparison
in ("T2T1", "T3T1", "D001")
): ):
click_chan.publish((debug_events.last_event, x, y, msg.hold_ms)) click_chan.publish((debug_events.last_event, x, y, msg.hold_ms))
# Button devices press specific button # Button devices press specific button
elif msg.physical_button is not None and utils.INTERNAL_MODEL in ("T2B1",): elif (
msg.physical_button is not None
and utils.INTERNAL_MODEL # pylint: disable=internal-model-tuple-comparison
in ("T2B1", "T3B1")
):
button_chan.publish( button_chan.publish(
(debug_events.last_event, msg.physical_button, msg.hold_ms) (debug_events.last_event, msg.physical_button, msg.hold_ms)
) )

View File

@ -94,8 +94,9 @@ async def _continue_recovery_process() -> Success:
if is_first_step: if is_first_step:
# If we are starting recovery, ask for word count first... # If we are starting recovery, ask for word count first...
# _request_word_count # _request_word_count
# For TT, just continuing straight to word count keyboard # For others than model_tr, just continue straight to word count keyboard
if utils.INTERNAL_MODEL == "T2B1": # pylint: disable-next=consider-using-in
if utils.INTERNAL_MODEL == "T2B1" or utils.INTERNAL_MODEL == "T3B1":
await layout.homescreen_dialog( await layout.homescreen_dialog(
TR.buttons__continue, TR.recovery__num_of_words TR.buttons__continue, TR.recovery__num_of_words
) )

View File

@ -56,9 +56,11 @@ def _find_message_handler_module(msg_type: int) -> str:
return "apps.management.reboot_to_bootloader" return "apps.management.reboot_to_bootloader"
if ( if (
utils.INTERNAL_MODEL in ("T2B1", "T3T1") # pylint: disable-next=consider-using-in
and msg_type == MessageType.ShowDeviceTutorial utils.INTERNAL_MODEL == "T2B1"
): or utils.INTERNAL_MODEL == "T3B1"
or utils.INTERNAL_MODEL == "T3T1"
) and msg_type == MessageType.ShowDeviceTutorial:
return "apps.management.show_tutorial" return "apps.management.show_tutorial"
if utils.USE_BACKLIGHT and msg_type == MessageType.SetBrightness: if utils.USE_BACKLIGHT and msg_type == MessageType.SetBrightness:

View File

@ -25,8 +25,11 @@ if utils.USE_OPTIGA:
# have to use "==" over "in (list)" so that it can be statically replaced # have to use "==" over "in (list)" so that it can be statically replaced
# with the correct value during the build process # with the correct value during the build process
# pylint: disable-next=consider-using-in if ( # pylint: disable-next=consider-using-in
if utils.INTERNAL_MODEL == "T2T1" or utils.INTERNAL_MODEL == "T2B1": utils.INTERNAL_MODEL == "T2T1"
or utils.INTERNAL_MODEL == "T2B1"
or utils.INTERNAL_MODEL == "T3B1"
):
_WELCOME_SCREEN_MS = 1000 # how long do we want to show welcome screen (minimum) _WELCOME_SCREEN_MS = 1000 # how long do we want to show welcome screen (minimum)
else: else:
_WELCOME_SCREEN_MS = 0 _WELCOME_SCREEN_MS = 0

View File

@ -53,7 +53,12 @@ else:
# in both debug and production, emulator needs to draw the screen explicitly # in both debug and production, emulator needs to draw the screen explicitly
if utils.EMULATOR or utils.INTERNAL_MODEL in ("T1B1", "T2B1"): if (
utils.EMULATOR
or utils.INTERNAL_MODEL == "T1B1"
or utils.INTERNAL_MODEL == "T2B1"
or utils.INTERNAL_MODEL == "T3B1"
):
loop.after_step_hook = refresh loop.after_step_hook = refresh

View File

@ -1,6 +1,6 @@
from common import * # isort:skip from common import * # isort:skip
if utils.INTERNAL_MODEL not in ("T2B1", "T3T1"): if utils.INTERNAL_MODEL in ("T1B1", "T2T1"):
from trezor.crypto import bip39 from trezor.crypto import bip39
from trezor.enums import AmountUnit, OutputScriptType from trezor.enums import AmountUnit, OutputScriptType
from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
@ -405,5 +405,5 @@ class TestSignTxDecred(unittest.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
if utils.INTERNAL_MODEL not in ("T2B1", "T3T1"): if utils.INTERNAL_MODEL in ("T1B1", "T2T1"):
unittest.main() unittest.main()

View File

@ -22,7 +22,7 @@ class TestCoins(unittest.TestCase):
("ZEC", "Zcash", 7352), ("ZEC", "Zcash", 7352),
("TAZ", "Zcash Testnet", 7461), ("TAZ", "Zcash Testnet", 7461),
] ]
if utils.INTERNAL_MODEL not in ("T2B1", "T3T1"): if utils.INTERNAL_MODEL in ("T1B1", "T2T1"):
ref.extend( ref.extend(
[ [
("NMC", "Namecoin", 52), ("NMC", "Namecoin", 52),