trezorctl/client: add self_test

pull/25/head
Pavol Rusnak 7 years ago
parent b9293d6bcb
commit bcf54dbe94
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -350,6 +350,10 @@ class Commands(object):
ret = self.client.set_u2f_counter(args.counter)
return ret
def self_test(self, args):
ret = self.client.self_test()
return ret
def firmware_update(self, args):
if args.file:
fp = open(args.file, 'rb').read()
@ -410,6 +414,7 @@ class Commands(object):
encrypt_keyvalue.help = 'Encrypt value by given key and path'
decrypt_keyvalue.help = 'Decrypt value by given key and path'
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)'
clear_session.arguments= ()
@ -552,6 +557,8 @@ class Commands(object):
(('counter',), {'type': int}),
)
self_test.arguments = ()
firmware_update.arguments = (
(('-f', '--file'), {'type': str}),
(('-u', '--url'), {'type': str}),

@ -1019,6 +1019,14 @@ class ProtocolMixin(object):
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):
pass

Loading…
Cancel
Save