def wait_for_fastboot(self, serial, timeout=5): with base_utils.timeout(seconds=timeout, error_message="Wait for fastboot timedout"): (out, err) = self.run_cmd(command="fastboot devices") while not serial in out: time.sleep(1) (out, err) = self.run_cmd(command="fastboot devices")
def wait_for_crashmode(self, serial, timeout=5): device_state = "bootloader" with base_utils.timeout(seconds=timeout, error_message="Wait for crashmode timedout"): (out, err) = self.run_cmd(command="adb devices") while device_state not in out: time.sleep(1) (out, err) = self.run_cmd(command="adb devices")
def wait_for_adb(self, serial, timeout=5, device_state="device"): with base_utils.timeout(seconds=timeout, error_message="adb device not found"): out = self.parse_cmd_output(cmd="adb devices", grep_for=serial) # (out,err) = self.run_cmd(command = "adb devices") while device_state not in out: time.sleep(1) # (out,err) = self.run_cmd(command = "adb devices") out = self.parse_cmd_output(cmd="adb devices", grep_for=serial)
def wait_for_no_ping(self, ip, num_packets=1, timeout=5): with base_utils.timeout(seconds=timeout, error_message="Ping timedout"): while self.check_ping(ip=ip, num_packets=num_packets): time.sleep(1) pass