def detect_smartcard_reader(self):
     print_error("[satochip] SatochipPlugin: detect_smartcard_reader"
                 )  #debugSatochip
     self.cardtype = AnyCardType()
     try:
         cardrequest = CardRequest(timeout=5, cardType=self.cardtype)
         cardservice = cardrequest.waitforcard()
         print_error(
             "[satochip] SatochipPlugin: detect_smartcard_reader: found card!"
         )  #debugSatochip
         return [
             Device(path="/satochip",
                    interface_number=-1,
                    id_="/satochip",
                    product_key=(SATOCHIP_VID, SATOCHIP_PID),
                    usage_page=0)
         ]
         #transport_ui_string='ccid')]
     except CardRequestTimeoutException:
         print('time-out: no card inserted during last 5s')
         return []
     except Exception as exc:
         print("Error during connection:", exc)
         return []
     return []
示例#2
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)
             for d in devices]
示例#3
0
 def enumerate(self):
     for dev in self.libusb_enumerate():
         path = self._USBDevice_getPath(dev)
         usb_id = (dev.getVendorID(), dev.getProductID())
         yield Device(path=path,
                      interface_number=-1,
                      id_=path,
                      product_key=usb_id,
                      usage_page=0)
示例#4
0
    def enumerate(self):
        from keepkeylib.transport_webusb import WebUsbTransport

        results = []

        for dev in WebUsbTransport.enumerate():
            path = ":".join(str(x) for x in ["%03i" % (dev.getBusNumber(),)] + dev.getPortNumberList())
            usb_id = (dev.getVendorID(), dev.getProductID())
            serial = dev.getSerialNumber()
            results.append(Device(path=path, interface_number=-1, id_=serial, product_key=usb_id, usage_page=0))

        return results
示例#5
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)
     return device
示例#6
0
 def detect_smartcard_reader(self):
     self.print_error("detect_smartcard_reader")#debugSatochip
     self.cardtype = AnyCardType()
     try:
         cardrequest = CardRequest(timeout=0.1, cardType=self.cardtype)
         cardservice = cardrequest.waitforcard()
         self.print_error("detect_smartcard_reader: found card!")#debugSatochip
         return [Device(path="/satochip",
                        interface_number=-1,
                        id_="/satochip",
                        product_key=(SATOCHIP_VID,SATOCHIP_PID),
                        usage_page=0)]
                        #transport_ui_string='ccid')]
     except CardRequestTimeoutException:
         self.print_error('time-out: no card found')
         return []
     except Exception as exc:
         self.print_error("Error during connection:", repr(exc), f"\n{traceback.format_exc()}")
         return []
     return []
示例#7
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
     ]