mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 06:48:16 +00:00
client: allow setting auto-lock delay
This commit is contained in:
parent
ab62f5db6f
commit
0a10b53e3a
17
trezorctl
17
trezorctl
@ -210,6 +210,23 @@ def set_passphrase_source(connect, source):
|
||||
return connect().apply_settings(passphrase_source=source)
|
||||
|
||||
|
||||
@cli.command(help='Set auto-lock delay (in seconds).')
|
||||
@click.argument('delay', type=str)
|
||||
@click.pass_obj
|
||||
def set_auto_lock_delay(connect, delay):
|
||||
value, unit = delay[:-1], delay[-1:]
|
||||
units = {
|
||||
's': 1,
|
||||
'm': 60,
|
||||
'h': 3600,
|
||||
}
|
||||
if unit in units:
|
||||
seconds = float(value) * units[unit]
|
||||
else:
|
||||
seconds = float(delay) # assume seconds if no unit is specified
|
||||
return connect().apply_settings(auto_lock_delay_ms=int(seconds * 1000))
|
||||
|
||||
|
||||
@cli.command(help='Set device flags.')
|
||||
@click.argument('flags')
|
||||
@click.pass_obj
|
||||
|
@ -643,7 +643,7 @@ class ProtocolMixin(object):
|
||||
|
||||
@field('message')
|
||||
@expect(proto.Success)
|
||||
def apply_settings(self, label=None, language=None, use_passphrase=None, homescreen=None, passphrase_source=None):
|
||||
def apply_settings(self, label=None, language=None, use_passphrase=None, homescreen=None, passphrase_source=None, auto_lock_delay_ms=None):
|
||||
settings = proto.ApplySettings()
|
||||
if label is not None:
|
||||
settings.label = label
|
||||
@ -655,6 +655,8 @@ class ProtocolMixin(object):
|
||||
settings.homescreen = homescreen
|
||||
if passphrase_source is not None:
|
||||
settings.passphrase_source = passphrase_source
|
||||
if auto_lock_delay_ms is not None:
|
||||
settings.auto_lock_delay_ms = auto_lock_delay_ms
|
||||
|
||||
out = self.call(settings)
|
||||
self.init_device() # Reload Features
|
||||
|
Loading…
Reference in New Issue
Block a user