Skip to content

Commit

Permalink
Change 'fastboot reboot recovery' to 'fastboot reboot-recovery'
Browse files Browse the repository at this point in the history
  • Loading branch information
tsterbak committed Oct 31, 2023
1 parent 929679a commit 51b4f86
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def logging_decorator(func) -> Callable:
def logging(*args, **kwargs) -> TerminalResponse:
logger.info(f"{step_desc} - Parameters: {kwargs}")
for line in func(*args, **kwargs):
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error(f"{step_desc} Failed!")
if return_if_fail:
yield False
Expand Down Expand Up @@ -199,7 +199,7 @@ def adb_twrp_format_data(bin_path: Path) -> TerminalResponse:
"""
unknown_command = False
for line in run_command("adb shell twrp format data", bin_path):
if (type(line) == str) and ("Unrecognized script command" in line):
if isinstance(line, str) and ("Unrecognized script command" in line):
unknown_command = True
yield line

Expand Down Expand Up @@ -261,7 +261,7 @@ def adb_twrp_wipe_and_install(
for line in run_command(f"adb shell twrp wipe {partition}", bin_path):
yield line
sleep(3)
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error(f"Wiping {partition} failed.")
# TODO: if this fails, a fix can be to just sideload something and then adb reboot
for line in adb_sideload(
Expand All @@ -270,7 +270,7 @@ def adb_twrp_wipe_and_install(
):
yield line
sleep(1)
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
yield False
break
sleep(2)
Expand Down Expand Up @@ -415,7 +415,7 @@ def fastboot_boot_recovery(
for line in run_command("fastboot boot", target=f"{recovery}", bin_path=bin_path):
yield line
if not is_ab:
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Booting recovery failed.")
yield False
else:
Expand All @@ -431,7 +431,7 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:
"fastboot flash boot", target=f"{recovery}", bin_path=bin_path
):
yield line
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Flashing recovery failed.")
yield False
else:
Expand All @@ -442,7 +442,7 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:
yield line
for line in adb_wait_for_recovery(bin_path=bin_path):
yield line
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Booting recovery failed.")
yield False
else:
Expand Down Expand Up @@ -479,7 +479,7 @@ def fastboot_flash_recovery(
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Flashing recovery failed.")
yield False
else:
Expand All @@ -490,9 +490,10 @@ def fastboot_flash_recovery(
def fastboot_reboot_recovery(bin_path: Path) -> TerminalResponse:
"""Reboot to recovery with fastboot.
Currently, it should only be used with Xiaomi devices.
WARNING: On some devices, users need to press a specific key combo to make it work.
"""
for line in run_command("fastboot reboot recovery", bin_path):
for line in run_command("fastboot reboot-recovery", bin_path):
yield line


Expand All @@ -514,7 +515,7 @@ def fastboot_flash_additional_partitions(
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Flashing dtbo failed.")
yield False
else:
Expand All @@ -531,7 +532,7 @@ def fastboot_flash_additional_partitions(
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Flashing vbmeta failed.")
yield False
else:
Expand All @@ -544,7 +545,7 @@ def fastboot_flash_additional_partitions(
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Wiping super failed.")
yield False
else:
Expand All @@ -557,7 +558,7 @@ def fastboot_flash_additional_partitions(
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
if isinstance(line, bool) and not line:
logger.error("Flashing vendor_boot failed.")
yield False
else:
Expand All @@ -570,7 +571,7 @@ def heimdall_wait_for_download_available(bin_path: Path) -> bool:
while True:
sleep(1)
for line in run_command("heimdall detect", bin_path=bin_path):
if (type(line) == bool) and line:
if isinstance(line, bool) and line:
return True


Expand Down

0 comments on commit 51b4f86

Please sign in to comment.