mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
wizard/hw: show transport type when listing HWDs
This commit is contained in:
parent
eba97f74b4
commit
32af83b7ae
5 changed files with 28 additions and 8 deletions
|
@ -283,8 +283,7 @@ class BaseWizard(object):
|
|||
for name, info in devices:
|
||||
state = _("initialized") if info.initialized else _("wiped")
|
||||
label = info.label or _("An unnamed {}").format(name)
|
||||
descr = f"{label} [{name}, {state}]"
|
||||
# TODO maybe expose info.device.path (mainly for transport type)
|
||||
descr = f"{label} [{name}, {state}, {info.device.transport_ui_string}]"
|
||||
choices.append(((name, info), descr))
|
||||
msg = _('Select a device') + ':'
|
||||
self.choice_dialog(title=title, message=msg, choices=choices, run_next= lambda *args: self.on_device(*args, purpose=purpose))
|
||||
|
|
|
@ -291,6 +291,7 @@ class Device(NamedTuple):
|
|||
id_: str
|
||||
product_key: Any # when using hid, often Tuple[int, int]
|
||||
usage_page: int
|
||||
transport_ui_string: str
|
||||
|
||||
|
||||
class DeviceInfo(NamedTuple):
|
||||
|
@ -576,8 +577,12 @@ class DeviceMgr(ThreadJob, PrintError):
|
|||
if len(id_) == 0:
|
||||
id_ = str(d['path'])
|
||||
id_ += str(interface_number) + str(usage_page)
|
||||
devices.append(Device(d['path'], interface_number,
|
||||
id_, product_key, usage_page))
|
||||
devices.append(Device(path=d['path'],
|
||||
interface_number=interface_number,
|
||||
id_=id_,
|
||||
product_key=product_key,
|
||||
usage_page=usage_page,
|
||||
transport_ui_string='hid'))
|
||||
return devices
|
||||
|
||||
def scan_devices(self):
|
||||
|
|
|
@ -625,10 +625,14 @@ class ColdcardPlugin(HW_PluginBase):
|
|||
fn = CKCC_SIMULATOR_PATH
|
||||
|
||||
if os.path.exists(fn):
|
||||
return [Device(fn, -1, fn, (COINKITE_VID, CKCC_SIMULATED_PID), 0)]
|
||||
return [Device(path=fn,
|
||||
interface_number=-1,
|
||||
id_=fn,
|
||||
product_key=(COINKITE_VID, CKCC_SIMULATED_PID),
|
||||
usage_page=0,
|
||||
transport_ui_string='simulator')]
|
||||
|
||||
return []
|
||||
|
||||
|
||||
def create_client(self, device, handler):
|
||||
if handler:
|
||||
|
|
|
@ -105,7 +105,13 @@ class SafeTPlugin(HW_PluginBase):
|
|||
|
||||
def enumerate(self):
|
||||
devices = self.transport_handler.enumerate_devices()
|
||||
return [Device(d.get_path(), -1, d.get_path(), 'Safe-T mini', 0) for d in devices]
|
||||
return [Device(path=d.get_path(),
|
||||
interface_number=-1,
|
||||
id_=d.get_path(),
|
||||
product_key='Safe-T mini',
|
||||
usage_page=0,
|
||||
transport_ui_string=d.get_path())
|
||||
for d in devices]
|
||||
|
||||
def create_client(self, device, handler):
|
||||
try:
|
||||
|
|
|
@ -106,7 +106,13 @@ class TrezorPlugin(HW_PluginBase):
|
|||
|
||||
def enumerate(self):
|
||||
devices = self.transport_handler.enumerate_devices()
|
||||
return [Device(d.get_path(), -1, d.get_path(), 'TREZOR', 0) for d in devices]
|
||||
return [Device(path=d.get_path(),
|
||||
interface_number=-1,
|
||||
id_=d.get_path(),
|
||||
product_key='TREZOR',
|
||||
usage_page=0,
|
||||
transport_ui_string=d.get_path())
|
||||
for d in devices]
|
||||
|
||||
def create_client(self, device, handler):
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue