File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -184,9 +184,19 @@ def adb_twrp_format_data(bin_path: Path) -> TerminalResponse:
184184
185185@add_logging ("Wipe the selected partition with adb and twrp." , return_if_fail = True )
186186def adb_twrp_wipe_partition (bin_path : Path , partition : str ) -> TerminalResponse :
187- """Perform a factory reset with twrp and adb."""
187+ """Perform a factory reset with twrp and adb.
188+
189+ If `format data` fails (for example because of old TWRP versions) we fall back to `wipe data`.
190+ """
188191 for line in run_command (f"adb shell twrp wipe { partition } " , bin_path ):
189192 yield line
193+ if (type (line ) == bool ) and not line :
194+ logger .info (
195+ "Factory reset with `adb twrp format data` failed. Trying `adb twrp wipe data` now."
196+ )
197+ sleep (1 )
198+ for line in adb_twrp_wipe_partition (bin_path = bin_path , partition = "data" ):
199+ yield line
190200
191201
192202def adb_twrp_wipe_and_install (
You can’t perform that action at this time.
0 commit comments