1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

implement set_flags (aka ApplyFlags)

This commit is contained in:
Pavol Rusnak 2017-07-17 18:36:53 +02:00
parent 36985519b5
commit de6402e95e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 262 additions and 188 deletions

View File

@ -183,6 +183,20 @@ def set_label(client, label):
return client.apply_settings(label=label)
@cli.command(help='Set device flags.')
@click.argument('flags')
@click.pass_obj
def set_flags(client, flags):
flags = flags.lower()
if flags.startswith('0b'):
flags = int(flags, 2)
elif flags.startswith('0x'):
flags = int(flags, 16)
else:
flags = int(flags)
return client.apply_flags(flags=flags)
@cli.command(help='Set new homescreen.')
@click.option('-f', '--filename', default=None)
@click.pass_obj

View File

@ -624,6 +624,13 @@ class ProtocolMixin(object):
self.init_device() # Reload Features
return out
@field('message')
@expect(proto.Success)
def apply_flags(self, flags):
out = self.call(proto.ApplyFlags(flags=flags))
self.init_device() # Reload Features
return out
@field('message')
@expect(proto.Success)
def clear_session(self):

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: types.proto
# libprotoc 3.3.0
# trezor-common b29b98d69ba43571dcbe54dc927aa3ecd2b95113
# trezor-common 2eb9c7e352f708506d910f2d5b9aac1e85cafa10
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))