mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-10 07:20:56 +00:00
Command firmware_update
This commit is contained in:
parent
e33be1965e
commit
02f6dd9681
14
cmd.py
14
cmd.py
@ -113,6 +113,14 @@ class Commands(object):
|
|||||||
|
|
||||||
return self.client.load_device(seed, args.pin)
|
return self.client.load_device(seed, args.pin)
|
||||||
|
|
||||||
|
def firmware_update(self, args):
|
||||||
|
fp = open(args.file, 'r')
|
||||||
|
if fp.read(4) != 'TRZR':
|
||||||
|
raise Exception("Trezor firmware header expected")
|
||||||
|
|
||||||
|
fp.seek(0)
|
||||||
|
return self.client.firmware_update(fp=open(args.file, 'r'), force=args.force)
|
||||||
|
|
||||||
list.help = 'List connected Trezor USB devices'
|
list.help = 'List connected Trezor USB devices'
|
||||||
ping.help = 'Send ping message'
|
ping.help = 'Send ping message'
|
||||||
get_address.help = 'Get bitcoin address in base58 encoding'
|
get_address.help = 'Get bitcoin address in base58 encoding'
|
||||||
@ -123,6 +131,7 @@ class Commands(object):
|
|||||||
set_label.help = 'Set new wallet label'
|
set_label.help = 'Set new wallet label'
|
||||||
set_coin.help = 'Switch device to another crypto currency'
|
set_coin.help = 'Switch device to another crypto currency'
|
||||||
load_device.help = 'Load custom configuration to the device'
|
load_device.help = 'Load custom configuration to the device'
|
||||||
|
firmware_update.help = 'Upload new firmware to device (must be in bootloader mode)'
|
||||||
|
|
||||||
get_address.arguments = (
|
get_address.arguments = (
|
||||||
(('n',), {'metavar': 'N', 'type': int, 'nargs': '+'}),
|
(('n',), {'metavar': 'N', 'type': int, 'nargs': '+'}),
|
||||||
@ -151,6 +160,11 @@ class Commands(object):
|
|||||||
(('-n', '--pin'), {'type': str, 'default': ''}),
|
(('-n', '--pin'), {'type': str, 'default': ''}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
firmware_update.arguments = (
|
||||||
|
(('-f', '--file'), {'type': str}),
|
||||||
|
(('-o', '--force'), {'type': bool, 'default': False})
|
||||||
|
)
|
||||||
|
|
||||||
def list_usb():
|
def list_usb():
|
||||||
from trezorlib.transport_hid import HidTransport
|
from trezorlib.transport_hid import HidTransport
|
||||||
devices = HidTransport.enumerate()
|
devices = HidTransport.enumerate()
|
||||||
|
Loading…
Reference in New Issue
Block a user