@classmethod
  def Connect(cls, usb, banner='notadb', rsa_keys=None, auth_timeout_ms=100):
    msg = cls(
        command='CNXN', arg0=VERSION, arg1=MAX_ADB_DATA,
        data='host::%s\0' % banner)
    msg.Send(usb)
    cmd, arg0, arg1, banner = cls.Read(usb, ['CNXN', 'AUTH'])
    if cmd == 'AUTH':
      if not rsa_keys:
        raise usb_exceptions.DeviceAuthError(
            'Device authentication required, no keys available.')
      # Loop through our keys, signing the last 'banner' or token.
      for rsa_key in rsa_keys:
        if arg0 != AUTH_TOKEN:
          raise InvalidResponseError(
              'Unknown AUTH response: %s %s %s' % (arg0, arg1, banner))

        signed_token = rsa_key.Sign(banner)
        msg = cls(
            command='AUTH', arg0=AUTH_SIGNATURE, arg1=0, data=signed_token)
        msg.Send(usb)
        cmd, arg0, unused_arg1, banner = cls.Read(usb, ['CNXN', 'AUTH'])
        if cmd == 'CNXN':
          return banner
      # None of the keys worked, so send a public key.
      msg = cls(
          command='AUTH', arg0=AUTH_RSAPUBLICKEY, arg1=0,
          data=rsa_keys[0].GetPublicKey() + '\0')
      msg.Send(usb)
      try:
        cmd, arg0, unused_arg1, banner = cls.Read(
            usb, ['CNXN'], timeout_ms=auth_timeout_ms)
      except usb_exceptions.BulkReadFailedError as e:
        if e.usb_error.value == -7:  # Timeout.
          raise usb_exceptions.DeviceAuthError(
              'Accept auth key on device, then retry.')
        raise
      # This didn't time-out, so we got a CNXN response.
      return banner
    return banner
Establish a new connection to the device.
dataset/ETHPy150Open google/python-adb/adb/adb_protocol.py/AdbMessage.Connect