def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec', adbPath='adb', deviceSerial=None, deviceRoot=None, logLevel=mozlog.ERROR, autoconnect=True, runAdbAsRoot=False, **kwargs): DeviceManager.__init__(self, logLevel=logLevel, deviceRoot=deviceRoot) self.host = host self.port = port self.retryLimit = retryLimit # the path to adb, or 'adb' to assume that it's on the PATH self._adbPath = adbPath # The serial number of the device to use with adb, used in cases # where multiple devices are being managed by the same adb instance. self._deviceSerial = deviceSerial # Some devices do no start adb as root, if allowed you can use # this to reboot adbd on the device as root automatically self._runAdbAsRoot = runAdbAsRoot if packageName == 'fennec': if os.getenv('USER'): self._packageName = 'org.mozilla.fennec_' + os.getenv('USER') else: self._packageName = 'org.mozilla.fennec_' elif packageName: self._packageName = packageName # verify that we can run the adb command. can't continue otherwise self._verifyADB() if autoconnect: self.connect()
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec', adbPath='adb', deviceSerial=None, deviceRoot=None, logLevel=mozlog.ERROR, **kwargs): DeviceManager.__init__(self, logLevel) self.host = host self.port = port self.retryLimit = retryLimit self.deviceRoot = deviceRoot # the path to adb, or 'adb' to assume that it's on the PATH self._adbPath = adbPath # The serial number of the device to use with adb, used in cases # where multiple devices are being managed by the same adb instance. self._deviceSerial = deviceSerial if packageName == 'fennec': if os.getenv('USER'): self._packageName = 'org.mozilla.fennec_' + os.getenv('USER') else: self._packageName = 'org.mozilla.fennec_' elif packageName: self._packageName = packageName # verify that we can run the adb command. can't continue otherwise self._verifyADB() # try to connect to the device over tcp/ip if we have a hostname if self.host: self._connectRemoteADB() # verify that we can connect to the device. can't continue self._verifyDevice() # set up device root self._setupDeviceRoot() # Some commands require root to work properly, even with ADB (e.g. # grabbing APKs out of /data). For these cases, we check whether # we're running as root. If that isn't true, check for the # existence of an su binary self._checkForRoot() # can we use zip to speed up some file operations? (currently not # required) try: self._verifyZip() except DMError: pass
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec', adbPath='adb', deviceSerial=None, deviceRoot=None, logLevel=mozlog.ERROR, **kwargs): DeviceManager.__init__(self, logLevel) self.host = host self.port = port self.retryLimit = retryLimit self.deviceRoot = deviceRoot # the path to adb, or 'adb' to assume that it's on the PATH self._adbPath = adbPath # The serial number of the device to use with adb, used in cases # where multiple devices are being managed by the same adb instance. self._deviceSerial = deviceSerial if packageName == 'fennec': if os.getenv('USER'): self._packageName = 'org.mozilla.fennec_' + os.getenv('USER') else: self._packageName = 'org.mozilla.fennec_' elif packageName: self._packageName = packageName # verify that we can run the adb command. can't continue otherwise self._verifyADB() # try to connect to the device over tcp/ip if we have a hostname if self.host: self._connectRemoteADB() # verify that we can connect to the device. can't continue self._verifyDevice() # set up device root self._setupDeviceRoot() # Some commands require root to work properly, even with ADB (e.g. # grabbing APKs out of /data). For these cases, we check whether # we're running as root. If that isn't true, check for the # existence of an su binary self._checkForRoot() # Can we use run-as? (not required) try: self._verifyRunAs() except DMError: pass # can we use zip to speed up some file operations? (currently not # required) try: self._verifyZip() except DMError: pass
def __init__(self, host, port=20701, retryLimit=5, deviceRoot=None, logLevel=logging.ERROR, **kwargs): DeviceManager.__init__(self, logLevel=logLevel, deviceRoot=deviceRoot) self.host = host self.port = port self.retryLimit = retryLimit self._sock = None self._everConnected = False # Get version verstring = self._runCmds([{'cmd': 'ver'}]) ver_re = re.match('(\S+) Version (\S+)', verstring) self.agentProductName = ver_re.group(1) self.agentVersion = ver_re.group(2)
def __init__(self, host, port=20701, retryLimit=5, deviceRoot=None, logLevel=mozlog.ERROR, **kwargs): DeviceManager.__init__(self, logLevel) self.host = host self.port = port self.retryLimit = retryLimit self._sock = None self._everConnected = False self.deviceRoot = deviceRoot # Initialize device root self.getDeviceRoot() # Get version verstring = self._runCmds([{"cmd": "ver"}]) ver_re = re.match("(\S+) Version (\S+)", verstring) self.agentProductName = ver_re.group(1) self.agentVersion = ver_re.group(2)
def __init__(self, host, port = 20701, retryLimit = 5, deviceRoot = None, logLevel = mozlog.ERROR, **kwargs): DeviceManager.__init__(self, logLevel) self.host = host self.port = port self.retryLimit = retryLimit self._sock = None self._everConnected = False self.deviceRoot = deviceRoot # Initialize device root self.getDeviceRoot() # Get version verstring = self._runCmds([{ 'cmd': 'ver' }]) ver_re = re.match('(\S+) Version (\S+)', verstring) self.agentProductName = ver_re.group(1) self.agentVersion = ver_re.group(2)