Пример #1
0
 def enumerate(self):
     devices = self.transport_handler.enumerate_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]
Пример #2
0
 def enumerate(self):
     from keepkeylib.transport_webusb import WebUsbTransport
     results = []
     for dev in WebUsbTransport.enumerate():
         path = self._dev_to_str(dev)
         results.append(Device(path=path,
                               interface_number=-1,
                               id_=path,
                               product_key=(dev.getVendorID(), dev.getProductID()),
                               usage_page=0,
                               transport_ui_string=f"webusb:{path}"))
     return results
Пример #3
0
    def detect_simulator(self):
        # if there is a simulator running on this machine,
        # return details about it so it's offered as a pairing choice
        fn = CKCC_SIMULATOR_PATH

        if os.path.exists(fn):
            return [Device(path=fn,
                           interface_number=-1,
                           id_=fn,
                           product_key=(COINKITE_VID, CKCC_SIMULATED_PID),
                           usage_page=0,
                           transport_ui_string='simulator')]

        return []
Пример #4
0
 def create_device_from_hid_enumeration(self, d: dict, *, product_key) -> Optional['Device']:
     # Older versions of hid don't provide interface_number
     interface_number = d.get('interface_number', -1)
     usage_page = d['usage_page']
     id_ = d['serial_number']
     if len(id_) == 0:
         id_ = str(d['path'])
     id_ += str(interface_number) + str(usage_page)
     device = Device(path=d['path'],
                     interface_number=interface_number,
                     id_=id_,
                     product_key=product_key,
                     usage_page=usage_page,
                     transport_ui_string='hid')
     return device
Пример #5
0
 def enumerate(self):
     # If there is a bridge, prefer that.
     # On Windows, the bridge runs as Admin (and Electrum usually does not),
     # so the bridge has better chances of finding devices. see #5420
     # This also avoids duplicate entries.
     if self.is_bridge_available():
         devices = BridgeTransport.enumerate()
     else:
         devices = trezorlib.transport.enumerate_devices()
     return [
         Device(path=d.get_path(),
                interface_number=-1,
                id_=d.get_path(),
                product_key=TREZOR_PRODUCT_KEY,
                usage_page=0,
                transport_ui_string=d.get_path()) for d in devices
     ]