Adjust private function names

This commit is contained in:
Mykola Grymalyuk
2023-02-10 08:02:50 -07:00
parent b81899092b
commit 2e7afae29b
6 changed files with 236 additions and 73 deletions
+6 -6
View File
@@ -20,8 +20,8 @@ class GenerateDefaults:
def __init__(self, model: str, host_is_target: bool, global_constants: constants.Constants): def __init__(self, model: str, host_is_target: bool, global_constants: constants.Constants):
self.constants: constants.Constants = global_constants self.constants: constants.Constants = global_constants
self.model = model self.model: str = model
self.host_is_target = host_is_target self.host_is_target: str = host_is_target
# Reset Variables # Reset Variables
self.constants.sip_status: bool = True self.constants.sip_status: bool = True
@@ -55,11 +55,11 @@ class GenerateDefaults:
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]: if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Users disabling TS2 most likely have a faulty dGPU # Users disabling TS2 most likely have a faulty dGPU
# users can override this in settings # users can override this in settings
ts2_status = global_settings.global_settings().read_property("MacBookPro_TeraScale_2_Accel") ts2_status = global_settings.GlobalEnviromentSettings().read_property("MacBookPro_TeraScale_2_Accel")
if ts2_status is True: if ts2_status is True:
self.constants.allow_ts2_accel = True self.constants.allow_ts2_accel = True
else: else:
global_settings.global_settings().write_property("MacBookPro_TeraScale_2_Accel", False) global_settings.GlobalEnviromentSettings().write_property("MacBookPro_TeraScale_2_Accel", False)
self.constants.allow_ts2_accel = False self.constants.allow_ts2_accel = False
if self.model in smbios_data.smbios_dictionary: if self.model in smbios_data.smbios_dictionary:
@@ -76,10 +76,10 @@ class GenerateDefaults:
# Check if running in RecoveryOS # Check if running in RecoveryOS
self.constants.recovery_status = utilities.check_recovery() self.constants.recovery_status = utilities.check_recovery()
if global_settings.global_settings().read_property("Force_Web_Drivers") is True: if global_settings.GlobalEnviromentSettings().read_property("Force_Web_Drivers") is True:
self.constants.force_nv_web = True self.constants.force_nv_web = True
result = global_settings.global_settings().read_property("ShouldNukeKDKs") result = global_settings.GlobalEnviromentSettings().read_property("ShouldNukeKDKs")
if result is False: if result is False:
self.constants.should_nuke_kdks = False self.constants.should_nuke_kdks = False
+5 -1
View File
@@ -9,7 +9,11 @@ import logging
import os import os
import subprocess import subprocess
class global_settings:
class GlobalEnviromentSettings:
"""
Library for querying and writing global enviroment settings
"""
def __init__(self): def __init__(self):
self.file_name: str = ".com.dortania.opencore-legacy-patcher.plist" self.file_name: str = ".com.dortania.opencore-legacy-patcher.plist"
+12 -12
View File
@@ -306,7 +306,7 @@ class wx_python_gui:
return return
did_find_update = False did_find_update = False
ignore_updates = global_settings.global_settings().read_property("IgnoreAppUpdates") ignore_updates = global_settings.GlobalEnviromentSettings().read_property("IgnoreAppUpdates")
if ignore_updates is not True: if ignore_updates is not True:
self.constants.ignore_updates = False self.constants.ignore_updates = False
self.constants.has_checked_updates = True self.constants.has_checked_updates = True
@@ -330,7 +330,7 @@ class wx_python_gui:
elif response == wx.ID_NO: elif response == wx.ID_NO:
logging.info("- Setting IgnoreAppUpdates to True") logging.info("- Setting IgnoreAppUpdates to True")
self.constants.ignore_updates = True self.constants.ignore_updates = True
global_settings.global_settings().write_property("IgnoreAppUpdates", True) global_settings.GlobalEnviromentSettings().write_property("IgnoreAppUpdates", True)
else: else:
self.constants.ignore_updates = True self.constants.ignore_updates = True
logging.info("- Ignoring App Updates due to defaults") logging.info("- Ignoring App Updates due to defaults")
@@ -588,10 +588,10 @@ class wx_python_gui:
if self.constants.start_build_install is True: if self.constants.start_build_install is True:
self.build_install_menu() self.build_install_menu()
elif "--gui_patch" in sys.argv: elif "--gui_patch" in sys.argv:
self.patches = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).detect_patch_set() self.patches = sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).detect_patch_set()
self.root_patch_start() self.root_patch_start()
elif "--gui_unpatch" in sys.argv: elif "--gui_unpatch" in sys.argv:
self.patches = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).detect_patch_set() self.patches = sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).detect_patch_set()
self.root_patch_revert() self.root_patch_revert()
self.finished_auto_patch = True self.finished_auto_patch = True
self.constants.start_build_install = False self.constants.start_build_install = False
@@ -1078,7 +1078,7 @@ class wx_python_gui:
) )
self.subheader.Centre(wx.HORIZONTAL) self.subheader.Centre(wx.HORIZONTAL)
patches = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).detect_patch_set() patches = sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).detect_patch_set()
self.patches = patches self.patches = patches
can_unpatch = patches["Validation: Unpatching Possible"] can_unpatch = patches["Validation: Unpatching Possible"]
if not any(not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True for patch in patches): if not any(not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True for patch in patches):
@@ -2988,7 +2988,7 @@ class wx_python_gui:
else: else:
logging.info("Nuke KDKs disabled") logging.info("Nuke KDKs disabled")
self.constants.should_nuke_kdks = False self.constants.should_nuke_kdks = False
global_settings.global_settings().write_property("ShouldNukeKDKs", self.constants.should_nuke_kdks) global_settings.GlobalEnviromentSettings().write_property("ShouldNukeKDKs", self.constants.should_nuke_kdks)
def disable_library_validation_click(self, event): def disable_library_validation_click(self, event):
if self.disable_library_validation_checkbox.GetValue(): if self.disable_library_validation_checkbox.GetValue():
@@ -3011,9 +3011,9 @@ class wx_python_gui:
def set_ignore_app_updates_click(self, event): def set_ignore_app_updates_click(self, event):
self.constants.ignore_updates = self.set_ignore_app_updates_checkbox.GetValue() self.constants.ignore_updates = self.set_ignore_app_updates_checkbox.GetValue()
if self.constants.ignore_updates is True: if self.constants.ignore_updates is True:
global_settings.global_settings().write_property("IgnoreAppUpdates", True) global_settings.GlobalEnviromentSettings().write_property("IgnoreAppUpdates", True)
else: else:
global_settings.global_settings().write_property("IgnoreAppUpdates", False) global_settings.GlobalEnviromentSettings().write_property("IgnoreAppUpdates", False)
def firewire_click(self, event=None): def firewire_click(self, event=None):
if self.firewire_boot_checkbox.GetValue(): if self.firewire_boot_checkbox.GetValue():
@@ -3098,21 +3098,21 @@ class wx_python_gui:
def ts2_accel_click(self, event=None): def ts2_accel_click(self, event=None):
if self.set_terascale_accel_checkbox.GetValue(): if self.set_terascale_accel_checkbox.GetValue():
logging.info("TS2 Acceleration Enabled") logging.info("TS2 Acceleration Enabled")
global_settings.global_settings().write_property("MacBookPro_TeraScale_2_Accel", True) global_settings.GlobalEnviromentSettings().write_property("MacBookPro_TeraScale_2_Accel", True)
self.constants.allow_ts2_accel = True self.constants.allow_ts2_accel = True
else: else:
logging.info("TS2 Acceleration Disabled") logging.info("TS2 Acceleration Disabled")
global_settings.global_settings().write_property("MacBookPro_TeraScale_2_Accel", False) global_settings.GlobalEnviromentSettings().write_property("MacBookPro_TeraScale_2_Accel", False)
self.constants.allow_ts2_accel = False self.constants.allow_ts2_accel = False
def force_web_drivers_click(self, event=None): def force_web_drivers_click(self, event=None):
if self.force_web_drivers_checkbox.GetValue(): if self.force_web_drivers_checkbox.GetValue():
logging.info("Force Web Drivers Enabled") logging.info("Force Web Drivers Enabled")
global_settings.global_settings().write_property("Force_Web_Drivers", True) global_settings.GlobalEnviromentSettings().write_property("Force_Web_Drivers", True)
self.constants.force_nv_web = True self.constants.force_nv_web = True
else: else:
logging.info("Force Web Drivers Disabled") logging.info("Force Web Drivers Disabled")
global_settings.global_settings().write_property("Force_Web_Drivers", False) global_settings.GlobalEnviromentSettings().write_property("Force_Web_Drivers", False)
self.constants.force_nv_web = False self.constants.force_nv_web = False
def windows_gmux_click(self, event=None): def windows_gmux_click(self, event=None):
+5 -5
View File
@@ -61,7 +61,7 @@ class PatchSysVolume:
# GUI will detect hardware patches before starting PatchSysVolume() # GUI will detect hardware patches before starting PatchSysVolume()
# However the TUI will not, so allow for data to be passed in manually avoiding multiple calls # However the TUI will not, so allow for data to be passed in manually avoiding multiple calls
if hardware_details is None: if hardware_details is None:
hardware_details = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).detect_patch_set() hardware_details = sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).detect_patch_set()
self.hardware_details = hardware_details self.hardware_details = hardware_details
self._init_pathing(custom_root_mount_path=None, custom_data_mount_path=None) self._init_pathing(custom_root_mount_path=None, custom_data_mount_path=None)
@@ -518,7 +518,7 @@ class PatchSysVolume:
if self.patch_set_dictionary != {}: if self.patch_set_dictionary != {}:
self._execute_patchset(self.patch_set_dictionary) self._execute_patchset(self.patch_set_dictionary)
else: else:
self._execute_patchset(sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).generate_patchset(self.hardware_details)) self._execute_patchset(sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).generate_patchset(self.hardware_details))
if self.constants.wxpython_variant is True and self.constants.detected_os >= os_data.os_data.big_sur: if self.constants.wxpython_variant is True and self.constants.detected_os >= os_data.os_data.big_sur:
sys_patch_auto.AutomaticSysPatch(self.constants).install_auto_patcher_launch_agent() sys_patch_auto.AutomaticSysPatch(self.constants).install_auto_patcher_launch_agent()
@@ -685,7 +685,7 @@ class PatchSysVolume:
def start_patch(self): def start_patch(self):
logging.info("- Starting Patch Process") logging.info("- Starting Patch Process")
logging.info(f"- Determining Required Patch set for Darwin {self.constants.detected_os}") logging.info(f"- Determining Required Patch set for Darwin {self.constants.detected_os}")
self.patch_set_dictionary = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).generate_patchset(self.hardware_details) self.patch_set_dictionary = sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).generate_patchset(self.hardware_details)
if self.patch_set_dictionary == {}: if self.patch_set_dictionary == {}:
change_menu = None change_menu = None
@@ -699,7 +699,7 @@ class PatchSysVolume:
logging.info("- Continuing root patching") logging.info("- Continuing root patching")
if change_menu in ["y", "Y"]: if change_menu in ["y", "Y"]:
logging.info("- Verifying whether Root Patching possible") logging.info("- Verifying whether Root Patching possible")
if sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=not self.constants.wxpython_variant) is True: if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=not self.constants.wxpython_variant) is True:
logging.info("- Patcher is capable of patching") logging.info("- Patcher is capable of patching")
if self._check_files(): if self._check_files():
if self._mount_root_vol() is True: if self._mount_root_vol() is True:
@@ -718,7 +718,7 @@ class PatchSysVolume:
def start_unpatch(self): def start_unpatch(self):
logging.info("- Starting Unpatch Process") logging.info("- Starting Unpatch Process")
if sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=True) is True: if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=True) is True:
if self._mount_root_vol() is True: if self._mount_root_vol() is True:
self._unpatch_root_vol() self._unpatch_root_vol()
if self.constants.gui_mode is False: if self.constants.gui_mode is False:
+2 -2
View File
@@ -31,7 +31,7 @@ class AutomaticSysPatch:
if utilities.check_seal() is True: if utilities.check_seal() is True:
logging.info("- Detected Snapshot seal intact, detecting patches") logging.info("- Detected Snapshot seal intact, detecting patches")
patches = sys_patch_detect.detect_root_patch(self.constants.computer.real_model, self.constants).detect_patch_set() patches = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set()
if not any(not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True for patch in patches): if not any(not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True for patch in patches):
patches = [] patches = []
if patches: if patches:
@@ -161,7 +161,7 @@ class AutomaticSysPatch:
# and ask if they want to install to install to disk # and ask if they want to install to install to disk
logging.info("- Determining if macOS drive matches boot drive") logging.info("- Determining if macOS drive matches boot drive")
should_notify = global_settings.global_settings().read_property("AutoPatch_Notify_Mismatched_Disks") should_notify = global_settings.GlobalEnviromentSettings().read_property("AutoPatch_Notify_Mismatched_Disks")
if should_notify is False: if should_notify is False:
logging.info("- Skipping due to user preference") logging.info("- Skipping due to user preference")
return return
+206 -47
View File
@@ -26,10 +26,16 @@ from data import (
) )
class detect_root_patch: class DetectRootPatch:
"""
Library for querying root volume patches applicable for booted system
"""
def __init__(self, model: str, global_constants: constants.Constants): def __init__(self, model: str, global_constants: constants.Constants):
self.model = model self.model: str = model
self.constants: constants.Constants = global_constants self.constants: constants.Constants = global_constants
self.computer = self.constants.computer self.computer = self.constants.computer
# GPU Patch Detection # GPU Patch Detection
@@ -77,7 +83,12 @@ class detect_root_patch:
self.missing_nv_web_opengl = False self.missing_nv_web_opengl = False
self.missing_nv_compat = False self.missing_nv_compat = False
def detect_gpus(self):
def _detect_gpus(self):
"""
Query GPUs and set flags for applicable patches
"""
gpus = self.constants.computer.gpus gpus = self.constants.computer.gpus
non_metal_os = os_data.os_data.catalina non_metal_os = os_data.os_data.catalina
for i, gpu in enumerate(gpus): for i, gpu in enumerate(gpus):
@@ -89,7 +100,7 @@ class detect_root_patch:
self.amfi_must_disable = True self.amfi_must_disable = True
if os_data.os_data.ventura in self.constants.legacy_accel_support: if os_data.os_data.ventura in self.constants.legacy_accel_support:
self.amfi_shim_bins = True self.amfi_shim_bins = True
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight() self.legacy_keyboard_backlight = self._check_legacy_keyboard_backlight()
self.requires_root_kc = True self.requires_root_kc = True
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler and self.constants.force_nv_web is False: elif gpu.arch == device_probe.NVIDIA.Archs.Kepler and self.constants.force_nv_web is False:
if self.constants.detected_os > os_data.os_data.big_sur: if self.constants.detected_os > os_data.os_data.big_sur:
@@ -179,7 +190,7 @@ class detect_root_patch:
self.amfi_must_disable = True self.amfi_must_disable = True
if os_data.os_data.ventura in self.constants.legacy_accel_support: if os_data.os_data.ventura in self.constants.legacy_accel_support:
self.amfi_shim_bins = True self.amfi_shim_bins = True
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight() self.legacy_keyboard_backlight = self._check_legacy_keyboard_backlight()
self.requires_root_kc = True self.requires_root_kc = True
elif gpu.arch == device_probe.Intel.Archs.Sandy_Bridge: elif gpu.arch == device_probe.Intel.Archs.Sandy_Bridge:
if self.constants.detected_os > non_metal_os: if self.constants.detected_os > non_metal_os:
@@ -187,7 +198,7 @@ class detect_root_patch:
self.amfi_must_disable = True self.amfi_must_disable = True
if os_data.os_data.ventura in self.constants.legacy_accel_support: if os_data.os_data.ventura in self.constants.legacy_accel_support:
self.amfi_shim_bins = True self.amfi_shim_bins = True
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight() self.legacy_keyboard_backlight = self._check_legacy_keyboard_backlight()
self.requires_root_kc = True self.requires_root_kc = True
elif gpu.arch == device_probe.Intel.Archs.Ivy_Bridge: elif gpu.arch == device_probe.Intel.Archs.Ivy_Bridge:
if self.constants.detected_os > os_data.os_data.big_sur: if self.constants.detected_os > os_data.os_data.big_sur:
@@ -234,17 +245,21 @@ class detect_root_patch:
self.requires_root_kc = True self.requires_root_kc = True
else: else:
if self.requires_root_kc is True: if self.requires_root_kc is True:
self.missing_kdk = not self.check_kdk() self.missing_kdk = not self._check_kdk()
self.check_networking_support() self._check_networking_support()
def check_networking_support(self): def _check_networking_support(self):
# On macOS Ventura, networking support is required to download KDKs. """
# However for machines such as BCM94322, BCM94328 and Atheros chipsets, Query for network requirement, ex. KDK downloading
# users may only have wifi as their only supported network interface.
# Thus we'll allow for KDK-less installs for these machines on first run. On macOS Ventura, networking support is required to download KDKs.
# On subsequent runs, we'll require networking to be enabled. However for machines such as BCM94322, BCM94328 and Atheros chipsets,
users may only have wifi as their only supported network interface.
Thus we'll allow for KDK-less installs for these machines on first run.
On subsequent runs, we'll require networking to be enabled.
"""
if self.constants.detected_os < os_data.os_data.ventura: if self.constants.detected_os < os_data.os_data.ventura:
return return
@@ -286,7 +301,11 @@ class detect_root_patch:
self.legacy_keyboard_backlight = False self.legacy_keyboard_backlight = False
def check_dgpu_status(self): def _check_dgpu_status(self):
"""
Query whether system has an active dGPU
"""
dgpu = self.constants.computer.dgpu dgpu = self.constants.computer.dgpu
if dgpu: if dgpu:
if dgpu.class_code and dgpu.class_code == 0xFFFFFFFF: if dgpu.class_code and dgpu.class_code == 0xFFFFFFFF:
@@ -295,25 +314,45 @@ class detect_root_patch:
return True return True
return False return False
def detect_demux(self):
def _detect_demux(self):
"""
Query whether system has been demuxed (ex. MacBookPro8,2, disabled dGPU)
"""
# If GFX0 is missing, assume machine was demuxed # If GFX0 is missing, assume machine was demuxed
# -wegnoegpu would also trigger this, so ensure arg is not present # -wegnoegpu would also trigger this, so ensure arg is not present
if not "-wegnoegpu" in (utilities.get_nvram("boot-args", decode=True) or ""): if not "-wegnoegpu" in (utilities.get_nvram("boot-args", decode=True) or ""):
igpu = self.constants.computer.igpu igpu = self.constants.computer.igpu
dgpu = self.check_dgpu_status() dgpu = self._check_dgpu_status()
if igpu and not dgpu: if igpu and not dgpu:
return True return True
return False return False
def check_legacy_keyboard_backlight(self):
def _check_legacy_keyboard_backlight(self):
"""
Query whether system has a legacy keyboard backlight
Returns:
bool: True if legacy keyboard backlight, False otherwise
"""
# iMac12,x+ have an 'ACPI0008' device, but it's not a keyboard backlight # iMac12,x+ have an 'ACPI0008' device, but it's not a keyboard backlight
# Best to assume laptops will have a keyboard backlight # Best to assume laptops will have a keyboard backlight
if self.model.startswith("MacBook"): if self.model.startswith("MacBook"):
return self.constants.computer.ambient_light_sensor return self.constants.computer.ambient_light_sensor
return False return False
def check_nv_web_nvram(self):
# First check boot-args, then dedicated nvram variable def _check_nv_web_nvram(self):
"""
Query for Nvidia Web Driver property: nvda_drv_vrl or nvda_drv
Returns:
bool: True if property is present, False otherwise
"""
nv_on = utilities.get_nvram("boot-args", decode=True) nv_on = utilities.get_nvram("boot-args", decode=True)
if nv_on: if nv_on:
if "nvda_drv_vrl=" in nv_on: if "nvda_drv_vrl=" in nv_on:
@@ -323,8 +362,17 @@ class detect_root_patch:
return True return True
return False return False
def check_nv_web_opengl(self):
# First check boot-args, then whether property exists on GPU def _check_nv_web_opengl(self):
"""
Query for Nvidia Web Driver property: ngfxgl
Verify Web Drivers will run in OpenGL mode
Returns:
bool: True if property is present, False otherwise
"""
nv_on = utilities.get_nvram("boot-args", decode=True) nv_on = utilities.get_nvram("boot-args", decode=True)
if nv_on: if nv_on:
if "ngfxgl=" in nv_on: if "ngfxgl=" in nv_on:
@@ -335,8 +383,17 @@ class detect_root_patch:
return True return True
return False return False
def check_nv_compat(self):
# Check for 'nv_web' in boot-args, then whether property exists on GPU def _check_nv_compat(self):
"""
Query for Nvidia Web Driver property: ngfxcompat
Verify Web Drivers will skip NVDAStartupWeb compatibility check
Returns:
bool: True if property is present, False otherwise
"""
nv_on = utilities.get_nvram("boot-args", decode=True) nv_on = utilities.get_nvram("boot-args", decode=True)
if nv_on: if nv_on:
if "ngfxcompat=" in nv_on: if "ngfxcompat=" in nv_on:
@@ -347,13 +404,37 @@ class detect_root_patch:
return True return True
return False return False
def check_whatevergreen(self):
def _check_whatevergreen(self):
"""
Query whether WhateverGreen.kext is loaded
Returns:
bool: True if loaded, False otherwise
"""
return utilities.check_kext_loaded("WhateverGreen", self.constants.detected_os) return utilities.check_kext_loaded("WhateverGreen", self.constants.detected_os)
def check_kdk(self):
def _check_kdk(self):
"""
Query whether Kernel Debug Kit is installed
Returns:
bool: True if installed, False otherwise
"""
return kdk_handler.KernelDebugKitObject(self.constants, self.constants.detected_os_build, self.constants.detected_os_version, passive=True).kdk_already_installed return kdk_handler.KernelDebugKitObject(self.constants, self.constants.detected_os_build, self.constants.detected_os_version, passive=True).kdk_already_installed
def check_sip(self):
def _check_sip(self):
"""
Query System Integrity checks required for patching
Returns:
tuple: (list, str, str) of SIP values, SIP hex, SIP error message
"""
if self.constants.detected_os > os_data.os_data.catalina: if self.constants.detected_os > os_data.os_data.catalina:
if self.nvidia_web is True: if self.nvidia_web is True:
sip = sip_data.system_integrity_protection.root_patch_sip_big_sur_3rd_part_kexts sip = sip_data.system_integrity_protection.root_patch_sip_big_sur_3rd_part_kexts
@@ -379,7 +460,15 @@ class detect_root_patch:
sip_value = f"For Hackintoshes, please set csr-active-config to '03060000' ({sip_hex})\nFor non-OpenCore Macs, please run 'csrutil disable' in RecoveryOS" sip_value = f"For Hackintoshes, please set csr-active-config to '03060000' ({sip_hex})\nFor non-OpenCore Macs, please run 'csrutil disable' in RecoveryOS"
return (sip, sip_value, sip_hex) return (sip, sip_value, sip_hex)
def check_uhci_ohci(self):
def _check_uhci_ohci(self):
"""
Query whether host has UHCI/OHCI controllers, and requires USB 1.1 patches
Returns:
bool: True if UHCI/OHCI patches required, False otherwise
"""
if self.constants.detected_os < os_data.os_data.ventura: if self.constants.detected_os < os_data.os_data.ventura:
return False return False
@@ -413,10 +502,19 @@ class detect_root_patch:
return False return False
# Entry point for patch set detection
def detect_patch_set(self): def detect_patch_set(self):
"""
Query patch sets required for host
Returns:
dict: Dictionary of patch sets
"""
self.has_network = network_handler.NetworkUtilities().verify_network_connection() self.has_network = network_handler.NetworkUtilities().verify_network_connection()
if self.check_uhci_ohci() is True: if self._check_uhci_ohci() is True:
self.legacy_uhci_ohci = True self.legacy_uhci_ohci = True
self.requires_root_kc = True self.requires_root_kc = True
@@ -449,12 +547,12 @@ class detect_root_patch:
if self.constants.detected_os > os_data.os_data.high_sierra: if self.constants.detected_os > os_data.os_data.high_sierra:
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]: if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Ref: https://doslabelectronics.com/Demux.html # Ref: https://doslabelectronics.com/Demux.html
if self.detect_demux() is True: if self._detect_demux() is True:
self.legacy_gmux = True self.legacy_gmux = True
else: else:
self.legacy_gmux = True self.legacy_gmux = True
self.detect_gpus() self._detect_gpus()
self.root_patch_dict = { self.root_patch_dict = {
"Graphics: Nvidia Tesla": self.nvidia_tesla, "Graphics: Nvidia Tesla": self.nvidia_tesla,
@@ -481,11 +579,11 @@ class detect_root_patch:
"Settings: Supports Auxiliary Cache": not self.requires_root_kc, "Settings: Supports Auxiliary Cache": not self.requires_root_kc,
"Settings: Kernel Debug Kit missing": self.missing_kdk if self.constants.detected_os >= os_data.os_data.ventura.value else False, "Settings: Kernel Debug Kit missing": self.missing_kdk if self.constants.detected_os >= os_data.os_data.ventura.value else False,
"Validation: Patching Possible": self.verify_patch_allowed(), "Validation: Patching Possible": self.verify_patch_allowed(),
"Validation: Unpatching Possible": self.verify_unpatch_allowed(), "Validation: Unpatching Possible": self._verify_unpatch_allowed(),
f"Validation: SIP is enabled (Required: {self.check_sip()[2]} or higher)": self.sip_enabled, f"Validation: SIP is enabled (Required: {self._check_sip()[2]} or higher)": self.sip_enabled,
f"Validation: Currently Booted SIP: ({hex(py_sip_xnu.SipXnu().get_sip_status().value)})": self.sip_enabled, f"Validation: Currently Booted SIP: ({hex(py_sip_xnu.SipXnu().get_sip_status().value)})": self.sip_enabled,
"Validation: SecureBootModel is enabled": self.sbm_enabled, "Validation: SecureBootModel is enabled": self.sbm_enabled,
f"Validation: {'AMFI' if self.constants.host_is_hackintosh is True or self.get_amfi_level_needed() > 2 else 'Library Validation'} is enabled": self.amfi_enabled if self.amfi_must_disable is True else False, f"Validation: {'AMFI' if self.constants.host_is_hackintosh is True or self._get_amfi_level_needed() > 2 else 'Library Validation'} is enabled": self.amfi_enabled if self.amfi_must_disable is True else False,
"Validation: FileVault is enabled": self.fv_enabled, "Validation: FileVault is enabled": self.fv_enabled,
"Validation: System is dosdude1 patched": self.dosdude_patched, "Validation: System is dosdude1 patched": self.dosdude_patched,
"Validation: WhateverGreen.kext missing": self.missing_whatever_green if self.nvidia_web is True else False, "Validation: WhateverGreen.kext missing": self.missing_whatever_green if self.nvidia_web is True else False,
@@ -497,7 +595,15 @@ class detect_root_patch:
return self.root_patch_dict return self.root_patch_dict
def get_amfi_level_needed(self):
def _get_amfi_level_needed(self):
"""
Query the AMFI level needed for the patcher to work
Returns:
int: AMFI level needed
"""
if self.amfi_must_disable is True: if self.amfi_must_disable is True:
if self.constants.detected_os > os_data.os_data.catalina: if self.constants.detected_os > os_data.os_data.catalina:
if self.constants.detected_os >= os_data.os_data.ventura: if self.constants.detected_os >= os_data.os_data.ventura:
@@ -508,19 +614,30 @@ class detect_root_patch:
return amfi_detect.AmfiConfigDetectLevel.LIBRARY_VALIDATION return amfi_detect.AmfiConfigDetectLevel.LIBRARY_VALIDATION
return amfi_detect.AmfiConfigDetectLevel.NO_CHECK return amfi_detect.AmfiConfigDetectLevel.NO_CHECK
def verify_patch_allowed(self, print_errors=False):
sip_dict = self.check_sip() def verify_patch_allowed(self, print_errors: bool = False):
"""
Validate that the patcher can be run
Parameters:
print_errors (bool): Print errors to console
Returns:
bool: True if patching is allowed, False otherwise
"""
sip_dict = self._check_sip()
sip = sip_dict[0] sip = sip_dict[0]
sip_value = sip_dict[1] sip_value = sip_dict[1]
self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched = utilities.patching_status(sip, self.constants.detected_os) self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched = utilities.patching_status(sip, self.constants.detected_os)
self.amfi_enabled = not amfi_detect.AmfiConfigurationDetection().check_config(self.get_amfi_level_needed()) self.amfi_enabled = not amfi_detect.AmfiConfigurationDetection().check_config(self._get_amfi_level_needed())
if self.nvidia_web is True: if self.nvidia_web is True:
self.missing_nv_web_nvram = not self.check_nv_web_nvram() self.missing_nv_web_nvram = not self._check_nv_web_nvram()
self.missing_nv_web_opengl = not self.check_nv_web_opengl() self.missing_nv_web_opengl = not self._check_nv_web_opengl()
self.missing_nv_compat = not self.check_nv_compat() self.missing_nv_compat = not self._check_nv_compat()
self.missing_whatever_green = not self.check_whatevergreen() self.missing_whatever_green = not self._check_whatevergreen()
if print_errors is True: if print_errors is True:
if self.sip_enabled is True: if self.sip_enabled is True:
@@ -591,25 +708,51 @@ class detect_root_patch:
else: else:
return True return True
def verify_unpatch_allowed(self, print_errors=False):
# Must be called after verify_patch_allowed def _verify_unpatch_allowed(self):
"""
Validate that the unpatcher can be run
Preconditions:
Must be called after verify_patch_allowed()
Returns:
bool: True if unpatching is allowed, False otherwise
"""
return not self.sip_enabled return not self.sip_enabled
def generate_patchset(self, hardware_details):
all_hardware_patchset = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support) def generate_patchset(self, hardware_details: dict):
required_patches = {} """
Generate Patchset dictionary for the current system
Parameters:
hardware_details (dict): Dictionary of hardware details generated by detect_patch_set()
Returns:
dict: Dictionary of patches to be applied from sys_patch_dict.py
"""
all_hardware_patchset: dict = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support)
required_patches: dict = {}
utilities.cls() utilities.cls()
logging.info("- The following patches will be applied:") logging.info("- The following patches will be applied:")
if hardware_details["Graphics: Intel Ironlake"] is True: if hardware_details["Graphics: Intel Ironlake"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]})
required_patches.update({"Intel Ironlake": all_hardware_patchset["Graphics"]["Intel Ironlake"]}) required_patches.update({"Intel Ironlake": all_hardware_patchset["Graphics"]["Intel Ironlake"]})
if hardware_details["Graphics: Intel Sandy Bridge"] is True: if hardware_details["Graphics: Intel Sandy Bridge"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Non-Metal ColorSync Workaround": all_hardware_patchset["Graphics"]["Non-Metal ColorSync Workaround"]}) required_patches.update({"Non-Metal ColorSync Workaround": all_hardware_patchset["Graphics"]["Non-Metal ColorSync Workaround"]})
required_patches.update({"High Sierra GVA": all_hardware_patchset["Graphics"]["High Sierra GVA"]}) required_patches.update({"High Sierra GVA": all_hardware_patchset["Graphics"]["High Sierra GVA"]})
required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]})
required_patches.update({"Intel Sandy Bridge": all_hardware_patchset["Graphics"]["Intel Sandy Bridge"]}) required_patches.update({"Intel Sandy Bridge": all_hardware_patchset["Graphics"]["Intel Sandy Bridge"]})
if hardware_details["Graphics: Intel Ivy Bridge"] is True: if hardware_details["Graphics: Intel Ivy Bridge"] is True:
required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]}) required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]})
required_patches.update({"Catalina GVA": all_hardware_patchset["Graphics"]["Catalina GVA"]}) required_patches.update({"Catalina GVA": all_hardware_patchset["Graphics"]["Catalina GVA"]})
@@ -617,23 +760,28 @@ class detect_root_patch:
required_patches.update({"Big Sur OpenCL": all_hardware_patchset["Graphics"]["Big Sur OpenCL"]}) required_patches.update({"Big Sur OpenCL": all_hardware_patchset["Graphics"]["Big Sur OpenCL"]})
required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]})
required_patches.update({"Intel Ivy Bridge": all_hardware_patchset["Graphics"]["Intel Ivy Bridge"]}) required_patches.update({"Intel Ivy Bridge": all_hardware_patchset["Graphics"]["Intel Ivy Bridge"]})
if hardware_details["Graphics: Intel Haswell"] is True: if hardware_details["Graphics: Intel Haswell"] is True:
required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]}) required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]})
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"Intel Haswell": all_hardware_patchset["Graphics"]["Intel Haswell"]}) required_patches.update({"Intel Haswell": all_hardware_patchset["Graphics"]["Intel Haswell"]})
if hardware_details["Graphics: Intel Broadwell"] is True: if hardware_details["Graphics: Intel Broadwell"] is True:
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"Intel Broadwell": all_hardware_patchset["Graphics"]["Intel Broadwell"]}) required_patches.update({"Intel Broadwell": all_hardware_patchset["Graphics"]["Intel Broadwell"]})
if hardware_details["Graphics: Intel Skylake"] is True: if hardware_details["Graphics: Intel Skylake"] is True:
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"Intel Skylake": all_hardware_patchset["Graphics"]["Intel Skylake"]}) required_patches.update({"Intel Skylake": all_hardware_patchset["Graphics"]["Intel Skylake"]})
if hardware_details["Graphics: Nvidia Tesla"] is True: if hardware_details["Graphics: Nvidia Tesla"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]})
required_patches.update({"Nvidia Tesla": all_hardware_patchset["Graphics"]["Nvidia Tesla"]}) required_patches.update({"Nvidia Tesla": all_hardware_patchset["Graphics"]["Nvidia Tesla"]})
if hardware_details["Graphics: Nvidia Web Drivers"] is True: if hardware_details["Graphics: Nvidia Web Drivers"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]}) required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]})
@@ -641,6 +789,7 @@ class detect_root_patch:
required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]})
required_patches.update({"Nvidia Web Drivers": all_hardware_patchset["Graphics"]["Nvidia Web Drivers"]}) required_patches.update({"Nvidia Web Drivers": all_hardware_patchset["Graphics"]["Nvidia Web Drivers"]})
required_patches.update({"Non-Metal Enforcement": all_hardware_patchset["Graphics"]["Non-Metal Enforcement"]}) required_patches.update({"Non-Metal Enforcement": all_hardware_patchset["Graphics"]["Non-Metal Enforcement"]})
if hardware_details["Graphics: Nvidia Kepler"] is True: if hardware_details["Graphics: Nvidia Kepler"] is True:
required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]}) required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]})
required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]}) required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]})
@@ -655,11 +804,13 @@ class detect_root_patch:
if "Catalina GVA" in required_patches: if "Catalina GVA" in required_patches:
del(required_patches["Catalina GVA"]) del(required_patches["Catalina GVA"])
break break
if hardware_details["Graphics: AMD TeraScale 1"] is True: if hardware_details["Graphics: AMD TeraScale 1"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]}) required_patches.update({"WebKit Monterey Common": all_hardware_patchset["Graphics"]["WebKit Monterey Common"]})
required_patches.update({"AMD TeraScale Common": all_hardware_patchset["Graphics"]["AMD TeraScale Common"]}) required_patches.update({"AMD TeraScale Common": all_hardware_patchset["Graphics"]["AMD TeraScale Common"]})
required_patches.update({"AMD TeraScale 1": all_hardware_patchset["Graphics"]["AMD TeraScale 1"]}) required_patches.update({"AMD TeraScale 1": all_hardware_patchset["Graphics"]["AMD TeraScale 1"]})
if hardware_details["Graphics: AMD TeraScale 2"] is True: if hardware_details["Graphics: AMD TeraScale 2"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]}) required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]}) required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]})
@@ -670,6 +821,7 @@ class detect_root_patch:
# TeraScale 2 MacBooks with faulty GPUs are highly prone to crashing with AMDRadeonX3000 attached # TeraScale 2 MacBooks with faulty GPUs are highly prone to crashing with AMDRadeonX3000 attached
# Additionally, AMDRadeonX3000 requires IOAccelerator downgrade which is not installed without 'Non-Metal IOAccelerator Common' # Additionally, AMDRadeonX3000 requires IOAccelerator downgrade which is not installed without 'Non-Metal IOAccelerator Common'
del(required_patches["AMD TeraScale 2"]["Install"]["/System/Library/Extensions"]["AMDRadeonX3000.kext"]) del(required_patches["AMD TeraScale 2"]["Install"]["/System/Library/Extensions"]["AMDRadeonX3000.kext"])
if hardware_details["Graphics: AMD Legacy GCN"] is True or hardware_details["Graphics: AMD Legacy Polaris"] is True: if hardware_details["Graphics: AMD Legacy GCN"] is True or hardware_details["Graphics: AMD Legacy Polaris"] is True:
required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]}) required_patches.update({"Revert Metal Downgrade": all_hardware_patchset["Graphics"]["Revert Metal Downgrade"]})
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
@@ -680,6 +832,7 @@ class detect_root_patch:
required_patches.update({"AMD Legacy Polaris": all_hardware_patchset["Graphics"]["AMD Legacy Polaris"]}) required_patches.update({"AMD Legacy Polaris": all_hardware_patchset["Graphics"]["AMD Legacy Polaris"]})
if "AVX2" not in self.constants.computer.cpu.leafs: if "AVX2" not in self.constants.computer.cpu.leafs:
required_patches.update({"AMD OpenCL": all_hardware_patchset["Graphics"]["AMD OpenCL"]}) required_patches.update({"AMD OpenCL": all_hardware_patchset["Graphics"]["AMD OpenCL"]})
if hardware_details["Graphics: AMD Legacy Vega"] is True: if hardware_details["Graphics: AMD Legacy Vega"] is True:
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]}) required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]}) required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
@@ -687,20 +840,26 @@ class detect_root_patch:
required_patches.update({"AMD OpenCL": all_hardware_patchset["Graphics"]["AMD OpenCL"]}) required_patches.update({"AMD OpenCL": all_hardware_patchset["Graphics"]["AMD OpenCL"]})
if hardware_details["Graphics: AMD Legacy GCN"] is True: if hardware_details["Graphics: AMD Legacy GCN"] is True:
required_patches.update({"AMD Legacy Vega Extended": all_hardware_patchset["Graphics"]["AMD Legacy Vega Extended"]}) required_patches.update({"AMD Legacy Vega Extended": all_hardware_patchset["Graphics"]["AMD Legacy Vega Extended"]})
if hardware_details["Brightness: Legacy Backlight Control"] is True: if hardware_details["Brightness: Legacy Backlight Control"] is True:
required_patches.update({"Legacy Backlight Control": all_hardware_patchset["Brightness"]["Legacy Backlight Control"]}) required_patches.update({"Legacy Backlight Control": all_hardware_patchset["Brightness"]["Legacy Backlight Control"]})
if hardware_details["Audio: Legacy Realtek"] is True: if hardware_details["Audio: Legacy Realtek"] is True:
if self.model in ["iMac7,1", "iMac8,1"]: if self.model in ["iMac7,1", "iMac8,1"]:
required_patches.update({"Legacy Realtek": all_hardware_patchset["Audio"]["Legacy Realtek"]}) required_patches.update({"Legacy Realtek": all_hardware_patchset["Audio"]["Legacy Realtek"]})
else: else:
required_patches.update({"Legacy Non-GOP": all_hardware_patchset["Audio"]["Legacy Non-GOP"]}) required_patches.update({"Legacy Non-GOP": all_hardware_patchset["Audio"]["Legacy Non-GOP"]})
if hardware_details["Networking: Legacy Wireless"] is True: if hardware_details["Networking: Legacy Wireless"] is True:
required_patches.update({"Legacy Wireless": all_hardware_patchset["Networking"]["Legacy Wireless"]}) required_patches.update({"Legacy Wireless": all_hardware_patchset["Networking"]["Legacy Wireless"]})
required_patches.update({"Legacy Wireless Extended": all_hardware_patchset["Networking"]["Legacy Wireless Extended"]}) required_patches.update({"Legacy Wireless Extended": all_hardware_patchset["Networking"]["Legacy Wireless Extended"]})
if hardware_details["Miscellaneous: Legacy GMUX"] is True: if hardware_details["Miscellaneous: Legacy GMUX"] is True:
required_patches.update({"Legacy GMUX": all_hardware_patchset["Miscellaneous"]["Legacy GMUX"]}) required_patches.update({"Legacy GMUX": all_hardware_patchset["Miscellaneous"]["Legacy GMUX"]})
if hardware_details["Miscellaneous: Legacy Keyboard Backlight"] is True: if hardware_details["Miscellaneous: Legacy Keyboard Backlight"] is True:
required_patches.update({"Legacy Keyboard Backlight": all_hardware_patchset["Miscellaneous"]["Legacy Keyboard Backlight"]}) required_patches.update({"Legacy Keyboard Backlight": all_hardware_patchset["Miscellaneous"]["Legacy Keyboard Backlight"]})
if hardware_details["Miscellaneous: Legacy USB 1.1"] is True: if hardware_details["Miscellaneous: Legacy USB 1.1"] is True:
required_patches.update({"Legacy USB 1.1": all_hardware_patchset["Miscellaneous"]["Legacy USB 1.1"]}) required_patches.update({"Legacy USB 1.1": all_hardware_patchset["Miscellaneous"]["Legacy USB 1.1"]})