mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 11:28:14 +00:00
trezorctl/client: add self_test
This commit is contained in:
parent
b9293d6bcb
commit
bcf54dbe94
@ -350,6 +350,10 @@ class Commands(object):
|
|||||||
ret = self.client.set_u2f_counter(args.counter)
|
ret = self.client.set_u2f_counter(args.counter)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def self_test(self, args):
|
||||||
|
ret = self.client.self_test()
|
||||||
|
return ret
|
||||||
|
|
||||||
def firmware_update(self, args):
|
def firmware_update(self, args):
|
||||||
if args.file:
|
if args.file:
|
||||||
fp = open(args.file, 'rb').read()
|
fp = open(args.file, 'rb').read()
|
||||||
@ -410,6 +414,7 @@ class Commands(object):
|
|||||||
encrypt_keyvalue.help = 'Encrypt value by given key and path'
|
encrypt_keyvalue.help = 'Encrypt value by given key and path'
|
||||||
decrypt_keyvalue.help = 'Decrypt value by given key and path'
|
decrypt_keyvalue.help = 'Decrypt value by given key and path'
|
||||||
set_u2f_counter.help = 'Set U2F counter'
|
set_u2f_counter.help = 'Set U2F counter'
|
||||||
|
self_test.help = 'Perform a self-test'
|
||||||
firmware_update.help = 'Upload new firmware to device (must be in bootloader mode)'
|
firmware_update.help = 'Upload new firmware to device (must be in bootloader mode)'
|
||||||
|
|
||||||
clear_session.arguments= ()
|
clear_session.arguments= ()
|
||||||
@ -552,6 +557,8 @@ class Commands(object):
|
|||||||
(('counter',), {'type': int}),
|
(('counter',), {'type': int}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self_test.arguments = ()
|
||||||
|
|
||||||
firmware_update.arguments = (
|
firmware_update.arguments = (
|
||||||
(('-f', '--file'), {'type': str}),
|
(('-f', '--file'), {'type': str}),
|
||||||
(('-u', '--url'), {'type': str}),
|
(('-u', '--url'), {'type': str}),
|
||||||
|
@ -1019,6 +1019,14 @@ class ProtocolMixin(object):
|
|||||||
|
|
||||||
raise Exception("Unexpected message %s" % resp)
|
raise Exception("Unexpected message %s" % resp)
|
||||||
|
|
||||||
|
@field('message')
|
||||||
|
@expect(proto.Success)
|
||||||
|
def self_test(self):
|
||||||
|
if self.features.bootloader_mode is False:
|
||||||
|
raise Exception("Device must be in bootloader mode")
|
||||||
|
|
||||||
|
return self.call(proto.SelfTest())
|
||||||
|
|
||||||
|
|
||||||
class TrezorClient(ProtocolMixin, TextUIMixin, BaseClient):
|
class TrezorClient(ProtocolMixin, TextUIMixin, BaseClient):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user