def adbLogin(self, device_id, original_prompt=r"[#$]"): """login process for android devices over adb""" adb_id = get_adb_id(device_id) subprocess.call(["adb", "-s", adb_id, "root"]) time.sleep(2) subprocess.call(["adb", "-s", adb_id, "wait-for-device"]) spawn._spawn(self, "adb -s " + adb_id + " shell") index = self.expect([original_prompt, TIMEOUT, EOF]) if index == 1 or index == 2: return False return True
def __init__(self, adbs_id=None, adb_id=None): if adbs_id is None and adb_id is None: raise StandardError("You must supply either an adbs or adb id") # adbs_id or device_id is used specially in adbs, so for those who # do not use that, supplying the adb_id will have to do if adb_id is not None: self._device_id = adb_id self._adb_id = adb_id else: self._device_id = adbs_id self._adb_id = get_adb_id(self._device_id) self._init_session() CommBase.__init__(self)
def __init__(self, device_id): self._device_id = device_id self._adb_id = get_adb_id(self._device_id) self._init_session() CommBase.__init__(self)