Exemplo n.º 1
0
 def _initialize_target(self):
     try:
         boot_state = local_utils.get_device_boot_state(
             serial=self.kwargs["serial"])
         if boot_state == "android":
             adb_connection = connection_adb(serial=self.kwargs["serial"])
             platform = adb_connection.get_prop(prop="ro.product.device")
         elif boot_state == "fastboot":
             if fastboot_utils.var_exists(var="product-string",
                                          serial=self.kwargs["serial"]):
                 product_string = fastboot_utils.get_var(
                     var="product-string", serial=self.kwargs["serial"])
                 platform = str(product_string).split("/")[-1]
             elif fastboot_utils.var_exists(var="product",
                                            serial=self.kwargs["serial"]):
                 product_string = fastboot_utils.get_var(
                     var="product", serial=self.kwargs["serial"])
                 platform = self.__SW_PLATFORMS[product_string]
         else:
             raise Exception("Invalid boot state - {0}".format(boot_state))
         target = self.__PLATFORMS[platform]
         self._platform = platform
         self._target = globals()[target](**self.kwargs)
     except:
         raise StaticsError(
             "{0}: Error while trying to get target from the device - {1}".
             format(self.kwargs["serial"], traceback.format_exc()))
Exemplo n.º 2
0
 def do(self):
     self.result = False
     time_passed = 0
     while local_utils.get_device_boot_state(serial=self.serial) != "charge_os" and time_passed < self.timeout:
         time.sleep(2)
         time_passed += 2
     if time_passed < self.timeout:
         self.result = True
Exemplo n.º 3
0
args = {}
for entry in script_args:
    key, val = entry.split("=")
    args[key] = val

relay_type = args["relay_type"]
relay_port = args["relay_port"]
power_port = args["power_port"]
v_up_port = args["v_up_port"]
v_down_port = args["v_down_port"]

##### test start #####
try:
    # ensure main OS is booted
    if local_utils.get_device_boot_state(serial=serial) != "android":
        relay_steps.reboot_main_os(serial=serial,
                                   relay_type=relay_type,
                                   relay_port=relay_port,
                                   power_port=power_port)()

    menu_position = statics.Device(serial=serial).ros_menu_entry["android"]

    # boot to recovery
    adb_steps.reboot_recovery(serial=serial)()

    time.sleep(3)

    # boot to main from ROS menu
    relay_steps.recovery_reboot(serial=serial,
                                mode="android",
def get_devices_info(command):
    r = os.popen(command)
    info = r.readlines()
    for line in info:
        line = line.strip("\r\n")
        line = line.split()
        for s in line:
            if "bxtp_abl" in s:
                return True
            if "gordon_peak" in s:
                return False

wait_ui = get_devices_info("adb shell getprop ro.product.device")

try:
    if local_utils.get_device_boot_state(serial = serial) == "fastboot":
        fastboot_steps.continue_to_adb(serial = serial)()

    adb_steps.reboot(command = "bootloader",
                     reboot_timeout = 300,
                     serial = serial)()

    fastboot_steps.reboot_fastboot(timeout = 300, serial = serial)()

    fastboot_steps.continue_to_adb(serial=serial)()

except:
    raise

finally:
    if serial in local_utils.get_fastboot_devices():
Exemplo n.º 5
0
# initialization #
globals().update(vars(get_args(sys.argv)))

args = {}
for entry in script_args:
    key, val = entry.split("=")
    args[key] = val

relay_type = args["relay_type"]
relay_port = args["relay_port"]
power_port = args["power_port"]

# test start #
try:
    device_state = local_utils.get_device_boot_state(serial=serial)

    if device_state == "fastboot":
        fastboot_steps.continue_to_adb(serial=serial)()
        adb_steps.wait_for_ui_processes(serial=serial)()
    elif device_state == "recovery":
        adb_steps.reboot(serial=serial)()
    elif device_state == "crashmode":
        print "adb -s {} reboot".format(serial)
        local_steps.command("adb -s {} reboot".format(serial))()
        local_steps.wait_for_adb(serial=serial)()
        adb_steps.wait_for_ui_processes(serial=serial)()
    else:
        relay_steps.reboot_main_os(serial=serial,
                                   relay_type=relay_type,
                                   relay_port=relay_port,