docs: def connect(self):
          """Enumerate and connect to the first available interface."""
          transport = self._defs.find_device()
          if not transport:
              raise interface.NotFoundError('{} not connected'.format(self))
  
          log.debug('using transport: %s', transport)
          for _ in range(5):  # Retry a few times in case of PIN failures
              connection = self._defs.Client(transport=transport,
                                             ui=self.ui,
                                             state=self.__class__.cached_state)
              self._verify_version(connection)
  
              try:
                  connection.ping(msg='', pin_protection=True)  # unlock PIN
                  return connection
              except (self._defs.PinException, ValueError) as e:
                  log.error('Invalid PIN: %s, retrying...', e)
                  continue
              except Exception as e:
                  log.exception('ping failed: %s', e)
                  connection.close()  # so the next HID open() will succeed
                  raise