mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
Module renamed from bitkeylib to trezorlib
This commit is contained in:
parent
66cede8e18
commit
333182f062
22
cmd.py
22
cmd.py
@ -3,12 +3,12 @@ import binascii
|
|||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from bitkeylib.client import BitkeyClient
|
from trezorlib.client import TrezorClient
|
||||||
from bitkeylib.debuglink import DebugLink
|
from trezorlib.debuglink import DebugLink
|
||||||
from bitkeylib.protobuf_json import pb2json
|
from trezorlib.protobuf_json import pb2json
|
||||||
|
|
||||||
def parse_args(commands):
|
def parse_args(commands):
|
||||||
parser = argparse.ArgumentParser(description='Commandline tool for Bitkey devices.')
|
parser = argparse.ArgumentParser(description='Commandline tool for Trezor devices.')
|
||||||
parser.add_argument('-t', '--transport', dest='transport', choices=['usb', 'serial', 'pipe', 'socket'], default='usb', help="Transport used for talking with the device")
|
parser.add_argument('-t', '--transport', dest='transport', choices=['usb', 'serial', 'pipe', 'socket'], default='usb', help="Transport used for talking with the device")
|
||||||
parser.add_argument('-p', '--path', dest='path', default='', help="Path used by the transport (usually serial port)")
|
parser.add_argument('-p', '--path', dest='path', default='', help="Path used by the transport (usually serial port)")
|
||||||
parser.add_argument('-dt', '--debuglink-transport', dest='debuglink_transport', choices=['usb', 'serial', 'pipe', 'socket'], default='socket', help="Debuglink transport")
|
parser.add_argument('-dt', '--debuglink-transport', dest='debuglink_transport', choices=['usb', 'serial', 'pipe', 'socket'], default='socket', help="Debuglink transport")
|
||||||
@ -41,7 +41,7 @@ def parse_args(commands):
|
|||||||
|
|
||||||
def get_transport(transport_string, path):
|
def get_transport(transport_string, path):
|
||||||
if transport_string == 'usb':
|
if transport_string == 'usb':
|
||||||
from bitkeylib.transport_hid import HidTransport
|
from trezorlib.transport_hid import HidTransport
|
||||||
|
|
||||||
if path == '':
|
if path == '':
|
||||||
try:
|
try:
|
||||||
@ -52,19 +52,19 @@ def get_transport(transport_string, path):
|
|||||||
return HidTransport(path)
|
return HidTransport(path)
|
||||||
|
|
||||||
if transport_string == 'serial':
|
if transport_string == 'serial':
|
||||||
from bitkeylib.transport_serial import SerialTransport
|
from trezorlib.transport_serial import SerialTransport
|
||||||
return SerialTransport(path)
|
return SerialTransport(path)
|
||||||
|
|
||||||
if transport_string == 'pipe':
|
if transport_string == 'pipe':
|
||||||
from bitkeylib.transport_pipe import PipeTransport
|
from trezorlib.transport_pipe import PipeTransport
|
||||||
return PipeTransport(path, is_device=False)
|
return PipeTransport(path, is_device=False)
|
||||||
|
|
||||||
if transport_string == 'socket':
|
if transport_string == 'socket':
|
||||||
from bitkeylib.transport_socket import SocketTransportClient
|
from trezorlib.transport_socket import SocketTransportClient
|
||||||
return SocketTransportClient(path)
|
return SocketTransportClient(path)
|
||||||
|
|
||||||
if transport_string == 'fake':
|
if transport_string == 'fake':
|
||||||
from bitkeylib.transport_fake import FakeTransport
|
from trezorlib.transport_fake import FakeTransport
|
||||||
return FakeTransport(path)
|
return FakeTransport(path)
|
||||||
|
|
||||||
raise NotImplemented("Unknown transport")
|
raise NotImplemented("Unknown transport")
|
||||||
@ -149,7 +149,7 @@ class Commands(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def list_usb():
|
def list_usb():
|
||||||
from bitkeylib.transport_hid import HidTransport
|
from trezorlib.transport_hid import HidTransport
|
||||||
devices = HidTransport.enumerate()
|
devices = HidTransport.enumerate()
|
||||||
return devices
|
return devices
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
debuglink = None
|
debuglink = None
|
||||||
|
|
||||||
client = BitkeyClient(transport, debuglink=debuglink)
|
client = TrezorClient(transport, debuglink=debuglink)
|
||||||
client.setup_debuglink(button=True, pin_correct=True)
|
client.setup_debuglink(button=True, pin_correct=True)
|
||||||
cmds = Commands(client)
|
cmds = Commands(client)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user