mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-05 13:01:12 +00:00
Fixed ApplySettings
This commit is contained in:
parent
e0ed224656
commit
981cf2ce7a
3
cmd.py
3
cmd.py
@ -170,7 +170,8 @@ class Commands(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
set_label.arguments = (
|
set_label.arguments = (
|
||||||
(('label',), {'type': str}),
|
(('-l', '--label',), {'type': str, 'default': ''}),
|
||||||
|
# (('-c', '--clear'), {'action': 'store_true', 'default': False})
|
||||||
)
|
)
|
||||||
|
|
||||||
load_device.arguments = (
|
load_device.arguments = (
|
||||||
|
@ -56,20 +56,25 @@ class TrezorClient(object):
|
|||||||
def expand_path(self, n):
|
def expand_path(self, n):
|
||||||
# Convert string of bip32 path to list of uint32 integers with prime flags
|
# Convert string of bip32 path to list of uint32 integers with prime flags
|
||||||
# 0/-1/1' -> [0, 0x80000001, 0x80000001]
|
# 0/-1/1' -> [0, 0x80000001, 0x80000001]
|
||||||
|
if not n:
|
||||||
|
return []
|
||||||
|
|
||||||
n = n.split('/')
|
n = n.split('/')
|
||||||
path = []
|
path = []
|
||||||
for x in n:
|
for x in n:
|
||||||
prime = False
|
prime = False
|
||||||
if '\'' in x:
|
if x.endswith("'"):
|
||||||
x = x.replace('\'', '')
|
x = x.replace('\'', '')
|
||||||
prime = True
|
prime = True
|
||||||
if '-' in x:
|
if x.startswith('-'):
|
||||||
prime = True
|
prime = True
|
||||||
|
|
||||||
|
x = abs(int(x))
|
||||||
|
|
||||||
if prime:
|
if prime:
|
||||||
path.append(abs(int(x)) | PRIME_DERIVATION_FLAG)
|
x |= PRIME_DERIVATION_FLAG
|
||||||
else:
|
|
||||||
path.append(abs(int(x)))
|
path.append(x)
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@ -96,12 +101,10 @@ class TrezorClient(object):
|
|||||||
def get_device_id(self):
|
def get_device_id(self):
|
||||||
return self.features.device_id
|
return self.features.device_id
|
||||||
|
|
||||||
def apply_settings(self, label=None, coin_shortcut=None, language=None):
|
def apply_settings(self, label=None, language=None):
|
||||||
settings = proto.ApplySettings()
|
settings = proto.ApplySettings()
|
||||||
if label:
|
if label != None:
|
||||||
settings.label = label
|
settings.label = label
|
||||||
if coin_shortcut:
|
|
||||||
settings.coin_shortcut = coin_shortcut
|
|
||||||
if language:
|
if language:
|
||||||
settings.language = language
|
settings.language = language
|
||||||
|
|
||||||
@ -306,7 +309,6 @@ class TrezorClient(object):
|
|||||||
pin_protection=bool(pin_protection),
|
pin_protection=bool(pin_protection),
|
||||||
label=label
|
label=label
|
||||||
)
|
)
|
||||||
print msg
|
|
||||||
resp = self.call(msg)
|
resp = self.call(msg)
|
||||||
if not isinstance(resp, proto.EntropyRequest):
|
if not isinstance(resp, proto.EntropyRequest):
|
||||||
raise Exception("Invalid response, expected EntropyRequest")
|
raise Exception("Invalid response, expected EntropyRequest")
|
||||||
|
Loading…
Reference in New Issue
Block a user