Ejemplo n.º 1
0
    def enumerate(self):

        try:
            # from smartcard.Exceptions import NoCardException
            from smartcard.System import readers
            # from smartcard.util import toHexString, toBytes
            # from btchip.btchipComm import DongleSmartcard
        except ImportError:
            return []

        sw_devices = []
        reader_id = 0
        for reader in readers():
            sw_devices.append(Device(reader, 0, reader_id, 'SW', 0))
            reader_id += 1

        return sw_devices
Ejemplo n.º 2
0
    def enumerate(self):
        try:
            from trezorlib.transport import all_transports
        except ImportError:
            # compat for trezorlib < 0.9.2
            def all_transports():
                from trezorlib.transport_bridge import BridgeTransport
                from trezorlib.transport_hid import HidTransport
                from trezorlib.transport_udp import UdpTransport
                from trezorlib.transport_webusb import WebUsbTransport
                return (BridgeTransport, HidTransport, UdpTransport, WebUsbTransport)

        devices = []
        for transport in all_transports():
            try:
                new_devices = transport.enumerate()
            except BaseException as e:
                self.print_error('enumerate failed for {}. error {}'
                                 .format(transport.__name__, str(e)))
            else:
                devices.extend(new_devices)

        return [Device(d.get_path(), -1, d.get_path(), 'TREZOR', 0) for d in devices]
Ejemplo n.º 3
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
     ]
Ejemplo n.º 4
0
 def enumerate(self):
     from trezorlib.device import TrezorDevice
     return [
         Device(d.get_path(), -1, d.get_path(), 'TREZOR', 0)
         for d in TrezorDevice.enumerate()
     ]
Ejemplo n.º 5
0
 def enumerate(self):
     devices = self._enumerate_devices()
     return [
         Device(d.get_path(), -1, d.get_path(), 'TREZOR', 0)
         for d in devices
     ]