mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-23 03:20:16 +10:00
Resolve Non-Metal Keyboard Backlight support
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 0.4.3
|
## 0.4.3
|
||||||
- Increment Binaries:
|
- Increment Binaries:
|
||||||
- PatcherSupportPkg 0.3.2 - release
|
- PatcherSupportPkg 0.3.3 - release
|
||||||
- OpenCorePkg 0.7.8 - release
|
- OpenCorePkg 0.7.8 - release
|
||||||
- Lilu 1.6.0 - release
|
- Lilu 1.6.0 - release
|
||||||
- WhateverGreen 1.5.7 - release
|
- WhateverGreen 1.5.7 - release
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
- Hardware Cursor
|
- Hardware Cursor
|
||||||
- Note cursor images will be static (ie. beachball)
|
- Note cursor images will be static (ie. beachball)
|
||||||
- Quicklook dismiss/expand
|
- Quicklook dismiss/expand
|
||||||
|
- Keyboard Backlight
|
||||||
|
- Drops reliance on LabTick
|
||||||
- Add Ethernet Controller detection to build
|
- Add Ethernet Controller detection to build
|
||||||
- Resolve i210/i225 NIC support on pre-Ivy Macs
|
- Resolve i210/i225 NIC support on pre-Ivy Macs
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Constants:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Patcher Versioning
|
# Patcher Versioning
|
||||||
self.patcher_version = "0.4.3" # OpenCore-Legacy-Patcher
|
self.patcher_version = "0.4.3" # OpenCore-Legacy-Patcher
|
||||||
self.patcher_support_pkg_version = "0.3.2" # PatcherSupportPkg
|
self.patcher_support_pkg_version = "0.3.3" # PatcherSupportPkg
|
||||||
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
|
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
|
||||||
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
|
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
|
||||||
self.discord_link = "https://discord.gg/rqdPgH8xSN"
|
self.discord_link = "https://discord.gg/rqdPgH8xSN"
|
||||||
@@ -698,10 +698,6 @@ class Constants:
|
|||||||
def legacy_wifi_support(self):
|
def legacy_wifi_support(self):
|
||||||
return self.payload_apple_application_support / Path("Legacy-Wifi")
|
return self.payload_apple_application_support / Path("Legacy-Wifi")
|
||||||
|
|
||||||
@property
|
|
||||||
def legacy_keyboard_backlight_support(self):
|
|
||||||
return self.payload_apple_application_support / Path("Keyboard-Backlight")
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def legacy_dropbox_support(self):
|
def legacy_dropbox_support(self):
|
||||||
return self.payload_apple_application_support / Path("Dropbox")
|
return self.payload_apple_application_support / Path("Dropbox")
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ class Computer:
|
|||||||
oclp_version: Optional[str] = None
|
oclp_version: Optional[str] = None
|
||||||
opencore_version: Optional[str] = None
|
opencore_version: Optional[str] = None
|
||||||
bluetooth_chipset: Optional[str] = None
|
bluetooth_chipset: Optional[str] = None
|
||||||
|
ambient_light_sensor: Optional[bool] = False
|
||||||
third_party_sata_ssd: Optional[bool] = False
|
third_party_sata_ssd: Optional[bool] = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -486,6 +487,7 @@ class Computer:
|
|||||||
computer.smbios_probe()
|
computer.smbios_probe()
|
||||||
computer.cpu_probe()
|
computer.cpu_probe()
|
||||||
computer.bluetooth_probe()
|
computer.bluetooth_probe()
|
||||||
|
computer.ambient_light_sensor_probe()
|
||||||
computer.sata_disk_probe()
|
computer.sata_disk_probe()
|
||||||
return computer
|
return computer
|
||||||
|
|
||||||
@@ -542,6 +544,12 @@ class Computer:
|
|||||||
break
|
break
|
||||||
ioreg.IOObjectRelease(device)
|
ioreg.IOObjectRelease(device)
|
||||||
|
|
||||||
|
def ambient_light_sensor_probe(self):
|
||||||
|
device = next(ioreg.ioiterator_to_list(ioreg.IOServiceGetMatchingServices(ioreg.kIOMasterPortDefault, ioreg.IOServiceNameMatching("ALS0".encode()), None)[1]), None)
|
||||||
|
if device:
|
||||||
|
self.ambient_light_sensor = True
|
||||||
|
ioreg.IOObjectRelease(device)
|
||||||
|
|
||||||
def usb_controller_probe(self):
|
def usb_controller_probe(self):
|
||||||
xhci_controllers = ioreg.ioiterator_to_list(
|
xhci_controllers = ioreg.ioiterator_to_list(
|
||||||
ioreg.IOServiceGetMatchingServices(
|
ioreg.IOServiceGetMatchingServices(
|
||||||
|
|||||||
@@ -229,9 +229,7 @@ class PatchSysVolume:
|
|||||||
print("- Failed to revert snapshot via bless, falling back on manual restoration")
|
print("- Failed to revert snapshot via bless, falling back on manual restoration")
|
||||||
self.manual_root_patch_revert()
|
self.manual_root_patch_revert()
|
||||||
else:
|
else:
|
||||||
if (Path(self.mount_application_support) / Path("SkyLightPlugins")).exists():
|
self.clean_skylight_plugins()
|
||||||
print("- Found SkylightPlugins folder, removing")
|
|
||||||
utilities.process_status(utilities.elevated(["rm", "-rf", f"{self.mount_application_support}/SkyLightPlugins"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
|
||||||
print("- Unpatching complete")
|
print("- Unpatching complete")
|
||||||
print("\nPlease reboot the machine for patches to take effect")
|
print("\nPlease reboot the machine for patches to take effect")
|
||||||
else:
|
else:
|
||||||
@@ -309,6 +307,11 @@ class PatchSysVolume:
|
|||||||
utilities.process_status(utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
utilities.process_status(utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
utilities.process_status(utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
utilities.process_status(utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
|
||||||
|
def clean_skylight_plugins(self):
|
||||||
|
if (Path(self.mount_application_support) / Path("SkyLightPlugins/")).exists():
|
||||||
|
print("- Found SkylightPlugins folder, removing")
|
||||||
|
utilities.process_status(utilities.elevated(["rm", "-rf", f"{self.mount_application_support}/SkyLightPlugins"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
|
||||||
def add_brightness_patch(self):
|
def add_brightness_patch(self):
|
||||||
self.delete_old_binaries(sys_patch_data.DeleteBrightness)
|
self.delete_old_binaries(sys_patch_data.DeleteBrightness)
|
||||||
self.add_new_binaries(sys_patch_data.AddBrightness, self.constants.legacy_brightness)
|
self.add_new_binaries(sys_patch_data.AddBrightness, self.constants.legacy_brightness)
|
||||||
@@ -347,8 +350,10 @@ class PatchSysVolume:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def add_legacy_keyboard_backlight_patch(self):
|
def add_legacy_keyboard_backlight_patch(self):
|
||||||
print("- Merging Keyboard Backlight SkyLightPlugins")
|
print("- Enabling Keyboard Backlight delay")
|
||||||
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_keyboard_backlight_support}/", self.mount_application_support], stdout=subprocess.PIPE)
|
utilities.process_status(
|
||||||
|
utilities.elevated(["defaults", "write", "/Library/Preferences/.GlobalPreferences.plist", "NonMetal_BacklightHack", "-bool", "true"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
)
|
||||||
|
|
||||||
def add_legacy_dropbox_patch(self):
|
def add_legacy_dropbox_patch(self):
|
||||||
print("- Merging DropboxHack SkyLightPlugins")
|
print("- Merging DropboxHack SkyLightPlugins")
|
||||||
@@ -404,7 +409,6 @@ class PatchSysVolume:
|
|||||||
self.gpu_accel_legacy()
|
self.gpu_accel_legacy()
|
||||||
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
|
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
|
||||||
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey] and self.constants.allow_ts2_accel is True:
|
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey] and self.constants.allow_ts2_accel is True:
|
||||||
# TODO: Enable for Monterey when acceleration patches proress
|
|
||||||
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
|
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
|
||||||
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11)
|
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11)
|
||||||
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11TS2)
|
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11TS2)
|
||||||
@@ -514,6 +518,9 @@ class PatchSysVolume:
|
|||||||
if self.constants.detected_os == os_data.os_data.monterey:
|
if self.constants.detected_os == os_data.os_data.monterey:
|
||||||
self.add_legacy_dropbox_patch()
|
self.add_legacy_dropbox_patch()
|
||||||
|
|
||||||
|
if self.legacy_keyboard_backlight is True:
|
||||||
|
self.add_legacy_keyboard_backlight_patch()
|
||||||
|
|
||||||
print("- Merging general legacy Frameworks")
|
print("- Merging general legacy Frameworks")
|
||||||
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if self.constants.detected_os > os_data.os_data.big_sur:
|
if self.constants.detected_os > os_data.os_data.big_sur:
|
||||||
@@ -551,6 +558,10 @@ class PatchSysVolume:
|
|||||||
|
|
||||||
def patch_root_vol(self):
|
def patch_root_vol(self):
|
||||||
print(f"- Running patches for {self.model}")
|
print(f"- Running patches for {self.model}")
|
||||||
|
|
||||||
|
# Before starting, clean out old plugins
|
||||||
|
self.clean_skylight_plugins()
|
||||||
|
|
||||||
# Graphics patches
|
# Graphics patches
|
||||||
if self.nvidia_legacy is True:
|
if self.nvidia_legacy is True:
|
||||||
print("- Installing legacy Nvidia Patches")
|
print("- Installing legacy Nvidia Patches")
|
||||||
@@ -639,10 +650,6 @@ class PatchSysVolume:
|
|||||||
print("- Installing Legacy Mux Brightness support")
|
print("- Installing Legacy Mux Brightness support")
|
||||||
self.add_legacy_mux_patch()
|
self.add_legacy_mux_patch()
|
||||||
|
|
||||||
if self.legacy_keyboard_backlight is True:
|
|
||||||
print("- Installing Legacy Keyboard Backlight support")
|
|
||||||
self.add_legacy_keyboard_backlight_patch()
|
|
||||||
|
|
||||||
if self.validate is False:
|
if self.validate is False:
|
||||||
self.rebuild_snapshot()
|
self.rebuild_snapshot()
|
||||||
|
|
||||||
|
|||||||
@@ -73,11 +73,13 @@ class detect_root_patch:
|
|||||||
if self.constants.detected_os > non_metal_os:
|
if self.constants.detected_os > non_metal_os:
|
||||||
self.iron_gpu = True
|
self.iron_gpu = True
|
||||||
self.amfi_must_disable = True
|
self.amfi_must_disable = True
|
||||||
|
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
|
||||||
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:
|
||||||
self.sandy_gpu = True
|
self.sandy_gpu = True
|
||||||
self.amfi_must_disable = True
|
self.amfi_must_disable = True
|
||||||
self.check_board_id = True
|
self.check_board_id = True
|
||||||
|
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
|
||||||
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:
|
||||||
self.ivy_gpu = True
|
self.ivy_gpu = True
|
||||||
@@ -90,6 +92,7 @@ class detect_root_patch:
|
|||||||
self.amd_ts2 = False
|
self.amd_ts2 = False
|
||||||
self.iron_gpu = False
|
self.iron_gpu = False
|
||||||
self.sandy_gpu = False
|
self.sandy_gpu = False
|
||||||
|
self.legacy_keyboard_backlight = False
|
||||||
|
|
||||||
def check_dgpu_status(self):
|
def check_dgpu_status(self):
|
||||||
dgpu = self.constants.computer.dgpu
|
dgpu = self.constants.computer.dgpu
|
||||||
@@ -111,14 +114,10 @@ class detect_root_patch:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def check_legacy_keyboard_backlight(self):
|
def check_legacy_keyboard_backlight(self):
|
||||||
# With Big Sur and newer, Skylight patch set unfortunately breaks native keyboard backlight
|
# iMac12,x+ have an 'ACPI0008' device, but it's not a keyboard backlight
|
||||||
# Penryn Macs are able to re-enable the keyboard backlight by simply running '/usr/libexec/TouchBarServer'
|
# Best to assume laptops will have a keyboard backlight
|
||||||
# For Arrendale and newer, this has no effect.
|
if self.model.startswith("MacBook"):
|
||||||
if self.model.startswith("MacBookPro") or self.model.startswith("MacBookAir"):
|
return self.constants.computer.ambient_light_sensor
|
||||||
# non-Metal MacBooks never had keyboard backlight
|
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
|
||||||
if self.constants.detected_os > os_data.os_data.catalina:
|
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def detect_patch_set(self):
|
def detect_patch_set(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user