From e8f2f7fd78bd947cc71bd8558a92c883f71dd596 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sun, 29 May 2022 11:09:48 -0600 Subject: [PATCH] sys_patch_dict.py: ensure `get_nvram()` decodes when `str` expected --- resources/sys_patch_detect.py | 8 ++++---- resources/utilities.py | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/resources/sys_patch_detect.py b/resources/sys_patch_detect.py index 622fc21ad..e51e9c8f9 100644 --- a/resources/sys_patch_detect.py +++ b/resources/sys_patch_detect.py @@ -123,7 +123,7 @@ class detect_root_patch: def detect_demux(self): # If GFX0 is missing, assume machine was demuxed # -wegnoegpu would also trigger this, so ensure arg is not present - if not "-wegnoegpu" in (utilities.get_nvram("boot-args") or ""): + if not "-wegnoegpu" in (utilities.get_nvram("boot-args", decode=True) or ""): igpu = self.constants.computer.igpu dgpu = self.check_dgpu_status() if igpu and not dgpu: @@ -139,7 +139,7 @@ class detect_root_patch: def check_nv_web_nvram(self): # First check boot-args, then dedicated nvram variable - nv_on = utilities.get_nvram("boot-args") + nv_on = utilities.get_nvram("boot-args", decode=True) if nv_on: if "nvda_drv_vrl=" in nv_on: return True @@ -150,7 +150,7 @@ class detect_root_patch: def check_nv_web_opengl(self): # First check boot-args, then whether property exists on GPU - nv_on = utilities.get_nvram("boot-args") + nv_on = utilities.get_nvram("boot-args", decode=True) if nv_on: if "ngfxgl=" in nv_on: return True @@ -162,7 +162,7 @@ class detect_root_patch: def check_nv_compat(self): # Check for 'nv_web' in boot-args, then whether property exists on GPU - nv_on = utilities.get_nvram("boot-args") + nv_on = utilities.get_nvram("boot-args", decode=True) if nv_on: if "ngfxcompat=" in nv_on: return True diff --git a/resources/utilities.py b/resources/utilities.py index 82cf8d943..e6ea35df3 100644 --- a/resources/utilities.py +++ b/resources/utilities.py @@ -157,7 +157,7 @@ def amfi_status(): if oclp_guid: if "-allow_amfi" in oclp_guid: return False - boot_args = get_nvram("boot-args", decode=False) + boot_args = get_nvram("boot-args", decode=True) if boot_args: for arg in amfi_args: if arg in boot_args: @@ -215,10 +215,11 @@ def check_metal_support(device_probe, computer): def check_filevault_skip(): # Check whether we can skip FileVault check with Root Patching - if get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False) and "-allow_fv" in get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True): - return True - else: - return False + nvram = get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) + if nvram: + if "-allow_fv" in nvram: + return True + return False def check_secure_boot_model():