From 1486859d79b4aac5ba8ae8ef65833e8c87566e7d Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Wed, 17 Nov 2021 12:22:57 -0700 Subject: [PATCH] Allow disabling of ConnectDrivers Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/742 --- CHANGELOG.md | 2 ++ resources/build.py | 3 +++ resources/cli_menu.py | 35 ++++++++++++++++++++++++++++++++++- resources/constants.py | 25 +++++++++++++------------ 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5505bf17b..af66ff294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ - Resolve rare memory corruption due to FeatureUnlock - Raise SurPlus MaxKernel to 21.99.99 - Fix Content Caching with spoofless usage +- Allow disabling of ConnectDrivers + - Aid with Hibernation on MacBookPro9,1/MacBookPro10,1 ## 0.3.1 - Increment Binaries: diff --git a/resources/build.py b/resources/build.py index afc3ad158..39b8913d4 100644 --- a/resources/build.py +++ b/resources/build.py @@ -796,6 +796,9 @@ class BuildOpenCore: if smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value: # Nehalem and newer MacBooks force firmware throttling via MSR_POWER_CTL self.enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path) + if self.constants.disable_connectdrivers is True: + print("- Disabling ConnectDrivers") + self.config["UEFI"]["ConnectDrivers"] = False if self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True: # Add Content Caching patch print("- Fixing Content Caching support") diff --git a/resources/cli_menu.py b/resources/cli_menu.py index f82a4da28..ff6f525fe 100644 --- a/resources/cli_menu.py +++ b/resources/cli_menu.py @@ -772,6 +772,37 @@ the event there's issues. else: self.set_surplus() + def set_hibernation_workaround(self): + utilities.cls() + utilities.header(["Set Hibernation Workaround"]) + print( + """ +For users with Hibernation issues, you can flip this option to disable certain +OpenCore settings that may affect the stability of Hibernation. Namely +OpenCore's ConnectDrivers option. + +Flipping this setting will disable automatic loading of additional drives in +OpenCore's boot menu other than what was booted. + +Note: This option should only be flipped under the following circumstances: + - You are experincing wake failures from hibernation + - You are only using 1 disk in your system for booting (ie. no RAID) + - OpenCore is installed on the same disk as the OS + - Your system has an Intel iGPU and Nvidia dGPU + - You have no need to boot external media through OpenCore + """ + ) + + change_menu = input("Disable ConnectDrivers?(y/n/q): ") + if change_menu in {"y", "Y", "yes", "Yes"}: + self.constants.disable_connectdrivers = True + elif change_menu in {"n", "N", "no", "No"}: + self.constants.disable_connectdrivers = False + elif change_menu in {"q", "Q", "Quit", "quit"}: + print("Returning to previous menu") + else: + self.set_hibernation_workaround() + def set_custom_sip_value(self): utilities.cls() utilities.header(["Set Custom SIP Value"]) @@ -1013,8 +1044,10 @@ system_profiler SPHardwareDataType | grep 'Model Identifier' f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support, ], - [f"Set Software Demux:\t\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux], + [f"Set Hibernation Workaround:\tCurrently {self.constants.disable_connectdrivers}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_hibernation_workaround], [f"Disable Battery Throttling:\tCurrently {self.constants.disable_msr_power_ctl}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_battery_throttle], + [f"Set Software Demux:\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux], + ] for option in options: diff --git a/resources/constants.py b/resources/constants.py index 244819e28..435801a2c 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -150,18 +150,19 @@ class Constants: self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support ## Miscellaneous - self.disallow_cpufriend = False # Disable CPUFriend - self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom - self.disable_tb = False # Disable Thunderbolt Controller - self.set_alc_usage = True # Set AppleALC usage - self.dGPU_switch = True # Set Display GPU Switching for Windows - self.force_surplus = False # Force SurPlus patch in newer OSes - self.force_latest_psp = False # Force latest PatcherSupportPkg - self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling) - self.software_demux = False # Enable Software Demux patch set - self.force_vmm = False # Force VMM patch - self.custom_sip_value = None # Set custom SIP value - self.walkthrough = False # Enable Walkthrough + self.disallow_cpufriend = False # Disable CPUFriend + self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom + self.disable_tb = False # Disable Thunderbolt Controller + self.set_alc_usage = True # Set AppleALC usage + self.dGPU_switch = True # Set Display GPU Switching for Windows + self.force_surplus = False # Force SurPlus patch in newer OSes + self.force_latest_psp = False # Force latest PatcherSupportPkg + self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling) + self.software_demux = False # Enable Software Demux patch set + self.force_vmm = False # Force VMM patch + self.custom_sip_value = None # Set custom SIP value + self.walkthrough = False # Enable Walkthrough + self.disable_connectdrivers = False # Disable ConnectDrivers (hibernation) self.legacy_accel_support = [ os_data.os_data.mojave,