Add Legacy Wireless support for Monterey

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/365
This commit is contained in:
Mykola Grymalyuk
2021-09-17 22:17:41 -06:00
parent 45332d2cf9
commit d1726f95fc
7 changed files with 69 additions and 53 deletions

View File

@@ -33,6 +33,7 @@ class PatchSysVolume:
self.ivy_gpu = False
self.brightness_legacy = False
self.legacy_audio = False
self.legacy_wifi = False
self.added_legacy_kexts = False
self.amfi_must_disable = False
self.check_board_id = False
@@ -48,10 +49,12 @@ class PatchSysVolume:
self.mount_location = "/System/Volumes/Update/mnt1"
else:
self.mount_location = ""
self.mount_coreservices = f"{self.mount_location}/System/Library/CoreServices"
self.mount_extensions = f"{self.mount_location}/System/Library/Extensions"
self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks"
self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons"
self.mount_private_frameworks = f"{self.mount_location}/System/Library/PrivateFrameworks"
self.mount_libexec = f"{self.mount_location}/usr/libexec"
def elevated(self, *args, **kwargs) -> subprocess.CompletedProcess:
if os.getuid() == 0 or self.constants.gui_mode is True:
@@ -291,6 +294,13 @@ set million colour before rebooting"""
def add_audio_patch(self):
self.delete_old_binaries(SysPatchArray.DeleteVolumeControl)
self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path)
def add_wifi_patch(self):
print("- Merging Wireless CoreSerices patches")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_wifi_coreservices}/", self.mount_coreservices], stdout=subprocess.PIPE)
print("- Merging Wireless usr/libexec patches")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_wifi_libexec}/", self.mount_libexec], stdout=subprocess.PIPE)
def gpu_accel_legacy(self):
if self.constants.detected_os == self.constants.mojave:
@@ -503,6 +513,11 @@ set million colour before rebooting"""
if self.legacy_audio is True:
print("- Fixing Volume Control Support")
self.add_audio_patch()
if self.legacy_wifi is True:
print("- Installing legacy Wireless support")
self.add_wifi_patch()
if self.validate is False:
self.rebuild_snapshot()
@@ -618,6 +633,13 @@ set million colour before rebooting"""
if self.constants.detected_os > self.constants.catalina:
self.legacy_audio = True
if (
isinstance(self.constants.computer.wifi, device_probe.Broadcom)
and self.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
if self.constants.detected_os > self.constants.big_sur:
self.legacy_wifi = True
Utilities.cls()
print("The following patches will be applied:")
if self.nvidia_legacy is True:
@@ -636,6 +658,8 @@ set million colour before rebooting"""
print("- Add Legacy Brightness Control")
if self.legacy_audio is True:
print("- Add legacy Audio Control")
if self.legacy_wifi is True:
print("- Add legacy WiFi Control")
self.no_patch = not any(
[
@@ -647,6 +671,7 @@ set million colour before rebooting"""
self.ivy_gpu,
self.brightness_legacy,
self.legacy_audio,
self.legacy_wifi,
]
)