Skip to content

Commit 51b4f86

Browse files
committed
Change 'fastboot reboot recovery' to 'fastboot reboot-recovery'
1 parent 929679a commit 51b4f86

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

openandroidinstaller/tooling.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def logging_decorator(func) -> Callable:
8787
def logging(*args, **kwargs) -> TerminalResponse:
8888
logger.info(f"{step_desc} - Parameters: {kwargs}")
8989
for line in func(*args, **kwargs):
90-
if (type(line) == bool) and not line:
90+
if isinstance(line, bool) and not line:
9191
logger.error(f"{step_desc} Failed!")
9292
if return_if_fail:
9393
yield False
@@ -199,7 +199,7 @@ def adb_twrp_format_data(bin_path: Path) -> TerminalResponse:
199199
"""
200200
unknown_command = False
201201
for line in run_command("adb shell twrp format data", bin_path):
202-
if (type(line) == str) and ("Unrecognized script command" in line):
202+
if isinstance(line, str) and ("Unrecognized script command" in line):
203203
unknown_command = True
204204
yield line
205205

@@ -261,7 +261,7 @@ def adb_twrp_wipe_and_install(
261261
for line in run_command(f"adb shell twrp wipe {partition}", bin_path):
262262
yield line
263263
sleep(3)
264-
if (type(line) == bool) and not line:
264+
if isinstance(line, bool) and not line:
265265
logger.error(f"Wiping {partition} failed.")
266266
# TODO: if this fails, a fix can be to just sideload something and then adb reboot
267267
for line in adb_sideload(
@@ -270,7 +270,7 @@ def adb_twrp_wipe_and_install(
270270
):
271271
yield line
272272
sleep(1)
273-
if (type(line) == bool) and not line:
273+
if isinstance(line, bool) and not line:
274274
yield False
275275
break
276276
sleep(2)
@@ -415,7 +415,7 @@ def fastboot_boot_recovery(
415415
for line in run_command("fastboot boot", target=f"{recovery}", bin_path=bin_path):
416416
yield line
417417
if not is_ab:
418-
if (type(line) == bool) and not line:
418+
if isinstance(line, bool) and not line:
419419
logger.error("Booting recovery failed.")
420420
yield False
421421
else:
@@ -431,7 +431,7 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:
431431
"fastboot flash boot", target=f"{recovery}", bin_path=bin_path
432432
):
433433
yield line
434-
if (type(line) == bool) and not line:
434+
if isinstance(line, bool) and not line:
435435
logger.error("Flashing recovery failed.")
436436
yield False
437437
else:
@@ -442,7 +442,7 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse:
442442
yield line
443443
for line in adb_wait_for_recovery(bin_path=bin_path):
444444
yield line
445-
if (type(line) == bool) and not line:
445+
if isinstance(line, bool) and not line:
446446
logger.error("Booting recovery failed.")
447447
yield False
448448
else:
@@ -479,7 +479,7 @@ def fastboot_flash_recovery(
479479
):
480480
yield line
481481
if not is_ab:
482-
if (type(line) == bool) and not line:
482+
if isinstance(line, bool) and not line:
483483
logger.error("Flashing recovery failed.")
484484
yield False
485485
else:
@@ -490,9 +490,10 @@ def fastboot_flash_recovery(
490490
def fastboot_reboot_recovery(bin_path: Path) -> TerminalResponse:
491491
"""Reboot to recovery with fastboot.
492492
493+
Currently, it should only be used with Xiaomi devices.
493494
WARNING: On some devices, users need to press a specific key combo to make it work.
494495
"""
495-
for line in run_command("fastboot reboot recovery", bin_path):
496+
for line in run_command("fastboot reboot-recovery", bin_path):
496497
yield line
497498

498499

@@ -514,7 +515,7 @@ def fastboot_flash_additional_partitions(
514515
):
515516
yield line
516517
if not is_ab:
517-
if (type(line) == bool) and not line:
518+
if isinstance(line, bool) and not line:
518519
logger.error("Flashing dtbo failed.")
519520
yield False
520521
else:
@@ -531,7 +532,7 @@ def fastboot_flash_additional_partitions(
531532
):
532533
yield line
533534
if not is_ab:
534-
if (type(line) == bool) and not line:
535+
if isinstance(line, bool) and not line:
535536
logger.error("Flashing vbmeta failed.")
536537
yield False
537538
else:
@@ -544,7 +545,7 @@ def fastboot_flash_additional_partitions(
544545
):
545546
yield line
546547
if not is_ab:
547-
if (type(line) == bool) and not line:
548+
if isinstance(line, bool) and not line:
548549
logger.error("Wiping super failed.")
549550
yield False
550551
else:
@@ -557,7 +558,7 @@ def fastboot_flash_additional_partitions(
557558
):
558559
yield line
559560
if not is_ab:
560-
if (type(line) == bool) and not line:
561+
if isinstance(line, bool) and not line:
561562
logger.error("Flashing vendor_boot failed.")
562563
yield False
563564
else:
@@ -570,7 +571,7 @@ def heimdall_wait_for_download_available(bin_path: Path) -> bool:
570571
while True:
571572
sleep(1)
572573
for line in run_command("heimdall detect", bin_path=bin_path):
573-
if (type(line) == bool) and line:
574+
if isinstance(line, bool) and line:
574575
return True
575576

576577

0 commit comments

Comments
 (0)