From 0da6a9f86e0c485dce4b582613568abf774b643e Mon Sep 17 00:00:00 2001 From: 9cb14c1ec0 <93002271+9cb14c1ec0@users.noreply.github.com> Date: Sat, 9 Mar 2024 11:30:29 -0500 Subject: [PATCH 1/2] Fix FileNotFound exception in mtk reset If logs don't exist for some reason, we don't need to trip up when deleting them, which prevents proper device shutdown. --- mtkclient/Library/DA/mtk_da_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mtkclient/Library/DA/mtk_da_handler.py b/mtkclient/Library/DA/mtk_da_handler.py index 95255be8..66d0d48e 100755 --- a/mtkclient/Library/DA/mtk_da_handler.py +++ b/mtkclient/Library/DA/mtk_da_handler.py @@ -747,7 +747,10 @@ def handle_da_cmds(self, mtk, cmd: str, args): elif cmd == "reset": if os.path.exists(".state"): os.remove(".state") - os.remove(os.path.join("logs", "hwparam.json")) + try: + os.remove(os.path.join("logs", "hwparam.json")) + except FileNotFoundError: + pass mtk.daloader.shutdown(bootmode=0) print("Reset command was sent. Disconnect usb cable to power off.") elif cmd == "da": From 5153d081d3dc8a628d6aaa6dbf0adc7eccb8ffed Mon Sep 17 00:00:00 2001 From: 9cb14c1ec0 <9cb14c1ec0@sendmeemail.xyz> Date: Sat, 4 May 2024 07:11:35 -0400 Subject: [PATCH 2/2] update commit --- mtkclient/Library/DA/mtk_da_handler.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mtkclient/Library/DA/mtk_da_handler.py b/mtkclient/Library/DA/mtk_da_handler.py index 66d0d48e..caf4ecd1 100755 --- a/mtkclient/Library/DA/mtk_da_handler.py +++ b/mtkclient/Library/DA/mtk_da_handler.py @@ -747,10 +747,8 @@ def handle_da_cmds(self, mtk, cmd: str, args): elif cmd == "reset": if os.path.exists(".state"): os.remove(".state") - try: + if os.path.exists(os.path.join("logs", "hwparam.json")): os.remove(os.path.join("logs", "hwparam.json")) - except FileNotFoundError: - pass mtk.daloader.shutdown(bootmode=0) print("Reset command was sent. Disconnect usb cable to power off.") elif cmd == "da":