mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-01 04:12:37 +00:00
common: rename Features.features to Features.capabilities
This commit is contained in:
parent
41428ab2df
commit
1a71c7a3e8
@ -58,24 +58,24 @@ message Features {
|
|||||||
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
|
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
|
||||||
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
|
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
|
||||||
optional bool recovery_mode = 29; // is recovery mode in progress
|
optional bool recovery_mode = 29; // is recovery mode in progress
|
||||||
repeated Feature features = 30; // list of supported features
|
repeated Capability capabilities = 30; // list of supported capabilities
|
||||||
enum Feature {
|
enum Capability {
|
||||||
Feature_Bitcoin = 1;
|
Capability_Bitcoin = 1;
|
||||||
Feature_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code
|
Capability_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code
|
||||||
Feature_Binance = 3;
|
Capability_Binance = 3;
|
||||||
Feature_Cardano = 4;
|
Capability_Cardano = 4;
|
||||||
Feature_Crypto = 5; // generic crypto operations for GPG, SSH, etc.
|
Capability_Crypto = 5; // generic crypto operations for GPG, SSH, etc.
|
||||||
Feature_EOS = 6;
|
Capability_EOS = 6;
|
||||||
Feature_Ethereum = 7;
|
Capability_Ethereum = 7;
|
||||||
Feature_Lisk = 8;
|
Capability_Lisk = 8;
|
||||||
Feature_Monero = 9;
|
Capability_Monero = 9;
|
||||||
Feature_NEM = 10;
|
Capability_NEM = 10;
|
||||||
Feature_Ripple = 11;
|
Capability_Ripple = 11;
|
||||||
Feature_Stellar = 12;
|
Capability_Stellar = 12;
|
||||||
Feature_Tezos = 13;
|
Capability_Tezos = 13;
|
||||||
Feature_U2F = 14;
|
Capability_U2F = 14;
|
||||||
Feature_Shamir = 15;
|
Capability_Shamir = 15;
|
||||||
Feature_ShamirGroups = 16;
|
Capability_ShamirGroups = 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from trezor import config, utils, wire
|
from trezor import config, utils, wire
|
||||||
from trezor.messages import Feature, MessageType
|
from trezor.messages import Capability, MessageType
|
||||||
from trezor.messages.Features import Features
|
from trezor.messages.Features import Features
|
||||||
from trezor.messages.Success import Success
|
from trezor.messages.Success import Success
|
||||||
from trezor.wire import register
|
from trezor.wire import register
|
||||||
@ -37,30 +37,30 @@ def get_features() -> Features:
|
|||||||
f.flags = storage.device.get_flags()
|
f.flags = storage.device.get_flags()
|
||||||
f.recovery_mode = storage.recovery.is_in_progress()
|
f.recovery_mode = storage.recovery.is_in_progress()
|
||||||
if utils.BITCOIN_ONLY:
|
if utils.BITCOIN_ONLY:
|
||||||
f.features = [
|
f.capabilities = [
|
||||||
Feature.Bitcoin,
|
Capability.Bitcoin,
|
||||||
Feature.Crypto,
|
Capability.Crypto,
|
||||||
Feature.Shamir,
|
Capability.Shamir,
|
||||||
Feature.ShamirGroups,
|
Capability.ShamirGroups,
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
f.features = [
|
f.capabilities = [
|
||||||
Feature.Bitcoin,
|
Capability.Bitcoin,
|
||||||
Feature.Bitcoin_like,
|
Capability.Bitcoin_like,
|
||||||
Feature.Binance,
|
Capability.Binance,
|
||||||
Feature.Cardano,
|
Capability.Cardano,
|
||||||
Feature.Crypto,
|
Capability.Crypto,
|
||||||
Feature.EOS,
|
Capability.EOS,
|
||||||
Feature.Ethereum,
|
Capability.Ethereum,
|
||||||
Feature.Lisk,
|
Capability.Lisk,
|
||||||
Feature.Monero,
|
Capability.Monero,
|
||||||
Feature.NEM,
|
Capability.NEM,
|
||||||
Feature.Ripple,
|
Capability.Ripple,
|
||||||
Feature.Stellar,
|
Capability.Stellar,
|
||||||
Feature.Tezos,
|
Capability.Tezos,
|
||||||
Feature.U2F,
|
Capability.U2F,
|
||||||
Feature.Shamir,
|
Capability.Shamir,
|
||||||
Feature.ShamirGroups,
|
Capability.ShamirGroups,
|
||||||
]
|
]
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ if __debug__:
|
|||||||
try:
|
try:
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
from typing_extensions import Literal # noqa: F401
|
from typing_extensions import Literal # noqa: F401
|
||||||
EnumTypeFeature = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Dict, List, Optional = None, None, None # type: ignore
|
Dict, List, Optional = None, None, None # type: ignore
|
||||||
EnumTypeFeature = None # type: ignore
|
EnumTypeCapability = None # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class Features(p.MessageType):
|
class Features(p.MessageType):
|
||||||
@ -45,7 +45,7 @@ class Features(p.MessageType):
|
|||||||
unfinished_backup: bool = None,
|
unfinished_backup: bool = None,
|
||||||
no_backup: bool = None,
|
no_backup: bool = None,
|
||||||
recovery_mode: bool = None,
|
recovery_mode: bool = None,
|
||||||
features: List[EnumTypeFeature] = None,
|
capabilities: List[EnumTypeCapability] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.vendor = vendor
|
self.vendor = vendor
|
||||||
self.major_version = major_version
|
self.major_version = major_version
|
||||||
@ -75,7 +75,7 @@ class Features(p.MessageType):
|
|||||||
self.unfinished_backup = unfinished_backup
|
self.unfinished_backup = unfinished_backup
|
||||||
self.no_backup = no_backup
|
self.no_backup = no_backup
|
||||||
self.recovery_mode = recovery_mode
|
self.recovery_mode = recovery_mode
|
||||||
self.features = features if features is not None else []
|
self.capabilities = capabilities if capabilities is not None else []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_fields(cls) -> Dict:
|
def get_fields(cls) -> Dict:
|
||||||
@ -108,5 +108,5 @@ class Features(p.MessageType):
|
|||||||
27: ('unfinished_backup', p.BoolType, 0),
|
27: ('unfinished_backup', p.BoolType, 0),
|
||||||
28: ('no_backup', p.BoolType, 0),
|
28: ('no_backup', p.BoolType, 0),
|
||||||
29: ('recovery_mode', p.BoolType, 0),
|
29: ('recovery_mode', p.BoolType, 0),
|
||||||
30: ('features', p.EnumType("Feature", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
||||||
}
|
}
|
||||||
|
@ -84,19 +84,19 @@ void fsm_msgGetFeatures(const GetFeatures *msg) {
|
|||||||
strlcpy(resp->model, "1", sizeof(resp->model));
|
strlcpy(resp->model, "1", sizeof(resp->model));
|
||||||
|
|
||||||
#if BITCOIN_ONLY
|
#if BITCOIN_ONLY
|
||||||
resp->features_count = 2;
|
resp->capabilities_count = 2;
|
||||||
resp->features[0] = Feature_Feature_Bitcoin;
|
resp->capabilities[0] = Capability_Capability_Bitcoin;
|
||||||
resp->features[1] = Feature_Feature_Crypto;
|
resp->capabilities[1] = Capability_Capability_Crypto;
|
||||||
#else
|
#else
|
||||||
resp->features_count = 8;
|
resp->capabilities_count = 8;
|
||||||
resp->features[0] = Feature_Feature_Bitcoin;
|
resp->capabilities[0] = Capability_Capability_Bitcoin;
|
||||||
resp->features[1] = Feature_Feature_Bitcoin_like;
|
resp->capabilities[1] = Capability_Capability_Bitcoin_like;
|
||||||
resp->features[2] = Feature_Feature_Crypto;
|
resp->capabilities[2] = Capability_Capability_Crypto;
|
||||||
resp->features[3] = Feature_Feature_Ethereum;
|
resp->capabilities[3] = Capability_Capability_Ethereum;
|
||||||
resp->features[4] = Feature_Feature_Lisk;
|
resp->capabilities[4] = Capability_Capability_Lisk;
|
||||||
resp->features[5] = Feature_Feature_NEM;
|
resp->capabilities[5] = Capability_Capability_NEM;
|
||||||
resp->features[6] = Feature_Feature_Stellar;
|
resp->capabilities[6] = Capability_Capability_Stellar;
|
||||||
resp->features[7] = Feature_Feature_U2F;
|
resp->capabilities[7] = Capability_Capability_U2F;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
msg_write(MessageType_MessageType_Features, resp);
|
msg_write(MessageType_MessageType_Features, resp);
|
||||||
|
@ -9,7 +9,7 @@ Features.bootloader_hash max_size:32
|
|||||||
Features.model max_size:17
|
Features.model max_size:17
|
||||||
Features.fw_vendor max_size:256
|
Features.fw_vendor max_size:256
|
||||||
Features.fw_vendor_keys max_size:32
|
Features.fw_vendor_keys max_size:32
|
||||||
Features.features max_count:32
|
Features.capabilities max_count:32
|
||||||
|
|
||||||
ApplySettings.language max_size:17
|
ApplySettings.language max_size:17
|
||||||
ApplySettings.label max_size:33
|
ApplySettings.label max_size:33
|
||||||
|
@ -6,10 +6,10 @@ if __debug__:
|
|||||||
try:
|
try:
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
from typing_extensions import Literal # noqa: F401
|
from typing_extensions import Literal # noqa: F401
|
||||||
EnumTypeFeature = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Dict, List, Optional = None, None, None # type: ignore
|
Dict, List, Optional = None, None, None # type: ignore
|
||||||
EnumTypeFeature = None # type: ignore
|
EnumTypeCapability = None # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class Features(p.MessageType):
|
class Features(p.MessageType):
|
||||||
@ -45,7 +45,7 @@ class Features(p.MessageType):
|
|||||||
unfinished_backup: bool = None,
|
unfinished_backup: bool = None,
|
||||||
no_backup: bool = None,
|
no_backup: bool = None,
|
||||||
recovery_mode: bool = None,
|
recovery_mode: bool = None,
|
||||||
features: List[EnumTypeFeature] = None,
|
capabilities: List[EnumTypeCapability] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.vendor = vendor
|
self.vendor = vendor
|
||||||
self.major_version = major_version
|
self.major_version = major_version
|
||||||
@ -75,7 +75,7 @@ class Features(p.MessageType):
|
|||||||
self.unfinished_backup = unfinished_backup
|
self.unfinished_backup = unfinished_backup
|
||||||
self.no_backup = no_backup
|
self.no_backup = no_backup
|
||||||
self.recovery_mode = recovery_mode
|
self.recovery_mode = recovery_mode
|
||||||
self.features = features if features is not None else []
|
self.capabilities = capabilities if capabilities is not None else []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_fields(cls) -> Dict:
|
def get_fields(cls) -> Dict:
|
||||||
@ -108,5 +108,5 @@ class Features(p.MessageType):
|
|||||||
27: ('unfinished_backup', p.BoolType, 0),
|
27: ('unfinished_backup', p.BoolType, 0),
|
||||||
28: ('no_backup', p.BoolType, 0),
|
28: ('no_backup', p.BoolType, 0),
|
||||||
29: ('recovery_mode', p.BoolType, 0),
|
29: ('recovery_mode', p.BoolType, 0),
|
||||||
30: ('features', p.EnumType("Feature", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
||||||
}
|
}
|
||||||
|
@ -254,8 +254,8 @@ from . import BinanceOrderSide
|
|||||||
from . import BinanceOrderType
|
from . import BinanceOrderType
|
||||||
from . import BinanceTimeInForce
|
from . import BinanceTimeInForce
|
||||||
from . import ButtonRequestType
|
from . import ButtonRequestType
|
||||||
|
from . import Capability
|
||||||
from . import FailureType
|
from . import FailureType
|
||||||
from . import Feature
|
|
||||||
from . import InputScriptType
|
from . import InputScriptType
|
||||||
from . import LiskTransactionType
|
from . import LiskTransactionType
|
||||||
from . import MessageType
|
from . import MessageType
|
||||||
|
@ -69,17 +69,17 @@ do_rebuild() {
|
|||||||
# TODO: make this less hackish
|
# TODO: make this less hackish
|
||||||
# maybe introduce attribute "altcoin" in protobuf?
|
# maybe introduce attribute "altcoin" in protobuf?
|
||||||
if [ "$APPLY_BITCOIN_ONLY" == "TRUE" ]; then
|
if [ "$APPLY_BITCOIN_ONLY" == "TRUE" ]; then
|
||||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/Feature.py
|
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/Capability.py
|
||||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/MessageType.py
|
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/MessageType.py
|
||||||
sed -i "/^EthereumGetPublicKey/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/MessageType.py
|
sed -i "/^EthereumGetPublicKey/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/MessageType.py
|
||||||
for altcoin in Ethereum NEM Lisk Tezos Stellar Cardano Ripple Monero DebugMonero Eos Binance; do
|
for altcoin in Ethereum NEM Lisk Tezos Stellar Cardano Ripple Monero DebugMonero Eos Binance; do
|
||||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/Feature.py
|
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/Capability.py
|
||||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/MessageType.py
|
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/MessageType.py
|
||||||
done
|
done
|
||||||
sed -i "/^Bitcoin_like/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Feature.py
|
sed -i "/^Bitcoin_like/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Capability.py
|
||||||
sed -i "/^EOS/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Feature.py
|
sed -i "/^EOS/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Capability.py
|
||||||
for feature in Bitcoin_like EOS U2F; do
|
for feature in Bitcoin_like EOS U2F; do
|
||||||
sed -i "s:^$feature: $feature:" "$DESTDIR"/Feature.py
|
sed -i "s:^$feature: $feature:" "$DESTDIR"/Capability.py
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# ENDTODO
|
# ENDTODO
|
||||||
|
Loading…
Reference in New Issue
Block a user