Ejemplo n.º 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]
Ejemplo n.º 2
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(fn, -1, fn, (COINKITE_VID, CKCC_SIMULATED_PID), 0)]

        return []
Ejemplo n.º 3
0
 def enumerate(self):
     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]
Ejemplo n.º 4
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
Ejemplo n.º 5
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 []
Ejemplo n.º 6
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
 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]
Ejemplo n.º 8
0
 def detect_smartcard_reader(self):
     _logger.info(f"[SatochipPlugin] detect_smartcard_reader")#debugSatochip
     self.cardtype = AnyCardType()
     try:
         cardrequest = CardRequest(timeout=5, cardType=self.cardtype)
         cardservice = cardrequest.waitforcard()
         return [Device(path="/satochip",
                        interface_number=-1,
                        id_="/satochip",
                        product_key=(SATOCHIP_VID,SATOCHIP_PID),
                        usage_page=0,
                        transport_ui_string='ccid')]
     except CardRequestTimeoutException:
         _logger.info(f'time-out: no card inserted during last 5s')
         return []
     except Exception as exc:
         _logger.info(f"Error during connection:{str(exc)}")
         return []
     return []
Ejemplo n.º 9
0
 def enumerate(self):
     devices = self.transport_handler.enumerate_devices()
     return [Device(d.get_path(), -1, d.get_path(), 'TREZOR', 0) for d in devices]