mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 22:00:00 +10:00
Use stock BlueToolFixup
This commit is contained in:
+6
-14
@@ -588,22 +588,14 @@ class BuildOpenCore:
|
|||||||
|
|
||||||
# Bluetooth Detection
|
# Bluetooth Detection
|
||||||
if not self.constants.custom_model and self.computer.bluetooth_chipset:
|
if not self.constants.custom_model and self.computer.bluetooth_chipset:
|
||||||
if self.computer.bluetooth_chipset == "BRCM2070 Hub":
|
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
|
||||||
print("- Enabling Bluetooth BRCM2070 for macOS Monterey")
|
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -brcm2070_patch"
|
|
||||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||||
elif self.computer.bluetooth_chipset == "BRCM2046 Hub":
|
self.enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||||
print("- Enabling Bluetooth BRCM2046 for macOS Monterey")
|
elif self.model in ModelArray.Bluetooth_BRCM2070 or self.model in ModelArray.Bluetooth_BRCM2046:
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -brcm2046_patch"
|
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
|
||||||
elif self.model in ModelArray.Bluetooth_BRCM2070:
|
|
||||||
print("- Enabling Bluetooth BRCM2070 for macOS Monterey")
|
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -brcm2070_patch"
|
|
||||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
|
||||||
elif self.model in ModelArray.Bluetooth_BRCM2046:
|
|
||||||
print("- Enabling Bluetooth BRCM2046 for macOS Monterey")
|
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -brcm2046_patch"
|
|
||||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||||
|
self.enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||||
|
|
||||||
# Add XhciDxe if firmware doesn't have XHCI controller support and XCHI controller detected
|
# Add XhciDxe if firmware doesn't have XHCI controller support and XCHI controller detected
|
||||||
# TODO: Fix XhciDxe to work on pre UEFI 2.0 Macs
|
# TODO: Fix XhciDxe to work on pre UEFI 2.0 Macs
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Constants:
|
|||||||
self.featureunlock_version = "1.0.3" # FeatureUnlock
|
self.featureunlock_version = "1.0.3" # FeatureUnlock
|
||||||
self.debugenhancer_version = "1.0.4" # DebugEnhancer
|
self.debugenhancer_version = "1.0.4" # DebugEnhancer
|
||||||
self.cpufriend_version = "1.2.4" # CPUFriend
|
self.cpufriend_version = "1.2.4" # CPUFriend
|
||||||
self.bluetool_version = "2.6.1" # BlueToolFixup
|
self.bluetool_version = "2.6.0" # BlueToolFixup
|
||||||
|
|
||||||
## Apple
|
## Apple
|
||||||
## https://www.apple.com
|
## https://www.apple.com
|
||||||
@@ -56,6 +56,7 @@ class Constants:
|
|||||||
self.backlight_injector_version = "1.0.0" # BacklightInjector
|
self.backlight_injector_version = "1.0.0" # BacklightInjector
|
||||||
self.smcspoof_version = "1.0.0" # SMC-Spoof
|
self.smcspoof_version = "1.0.0" # SMC-Spoof
|
||||||
self.mce_version = "1.0.0" # AppleMCEReporterDisabler
|
self.mce_version = "1.0.0" # AppleMCEReporterDisabler
|
||||||
|
self.btspoof_version = "1.0.0" # Bluetooth-Spoof
|
||||||
|
|
||||||
## Syncretic
|
## Syncretic
|
||||||
## https://forums.macrumors.com/members/syncretic.1173816/
|
## https://forums.macrumors.com/members/syncretic.1173816/
|
||||||
@@ -314,6 +315,10 @@ class Constants:
|
|||||||
def smcspoof_path(self):
|
def smcspoof_path(self):
|
||||||
return self.payload_kexts_path / Path(f"Misc/SMC-Spoof-v{self.smcspoof_version}.zip")
|
return self.payload_kexts_path / Path(f"Misc/SMC-Spoof-v{self.smcspoof_version}.zip")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def btspoof_path(self):
|
||||||
|
return self.payload_kexts_path / Path(f"Misc/Bluetooth-Spoof-v{self.btspoof_version}.zip")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def nvmefix_path(self):
|
def nvmefix_path(self):
|
||||||
return self.payload_kexts_path / Path(f"Acidanthera/NVMeFix-v{self.nvmefix_version}.zip")
|
return self.payload_kexts_path / Path(f"Acidanthera/NVMeFix-v{self.nvmefix_version}.zip")
|
||||||
|
|||||||
@@ -610,6 +610,24 @@
|
|||||||
<key>PlistPath</key>
|
<key>PlistPath</key>
|
||||||
<string>Contents/Info.plist</string>
|
<string>Contents/Info.plist</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>Arch</key>
|
||||||
|
<string>x86_64</string>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Bluetooth Patch for BRCM2046 and BRCM2070</string>
|
||||||
|
<key>Enabled</key>
|
||||||
|
<false/>
|
||||||
|
<key>MaxKernel</key>
|
||||||
|
<string></string>
|
||||||
|
<key>MinKernel</key>
|
||||||
|
<string>21.0.0</string>
|
||||||
|
<key>BundlePath</key>
|
||||||
|
<string>Bluetooth-Spoof.kext</string>
|
||||||
|
<key>ExecutablePath</key>
|
||||||
|
<string></string>
|
||||||
|
<key>PlistPath</key>
|
||||||
|
<string>Contents/Info.plist</string>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Arch</key>
|
<key>Arch</key>
|
||||||
<string>x86_64</string>
|
<string>x86_64</string>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,42 +0,0 @@
|
|||||||
diff --git a/BrcmPatchRAM/BlueToolFixup.cpp b/BrcmPatchRAM/BlueToolFixup.cpp
|
|
||||||
index 0fa891a..819eb3f 100644
|
|
||||||
--- a/BrcmPatchRAM/BlueToolFixup.cpp
|
|
||||||
+++ b/BrcmPatchRAM/BlueToolFixup.cpp
|
|
||||||
@@ -50,7 +50,15 @@ bool BlueToolFixup::start(IOService *provider) {
|
|
||||||
static const uint8_t kSkipUpdateFilePathOriginal[] = "/etc/bluetool/SkipBluetoothAutomaticFirmwareUpdate";
|
|
||||||
static const uint8_t kSkipUpdateFilePathPatched[] = "/System/Library/CoreServices/boot.efi";
|
|
||||||
|
|
||||||
+static const uint8_t kBluetoothUSBNameOriginal[] = "Bluetooth USB Host Controller";
|
|
||||||
+static const uint8_t kBluetoothUSBNamePatched2070[] = "BRCM2070 Hub Host Controller";
|
|
||||||
+static const uint8_t kBluetoothUSBNamePatched2046[] = "BRCM2046 Hub Host Controller";
|
|
||||||
+
|
|
||||||
static const char *blueToolPath = "/usr/sbin/BlueTool";
|
|
||||||
+static const char *bluetoothdPath = "/usr/sbin/bluetoothd";
|
|
||||||
+
|
|
||||||
+static const char brcm2046_patch = checkKernelArgument("-brcm2046_patch");
|
|
||||||
+static const char brcm2070_patch = checkKernelArgument("-brcm2070_patch");
|
|
||||||
|
|
||||||
static mach_vm_address_t orig_cs_validate {};
|
|
||||||
|
|
||||||
@@ -71,8 +79,19 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o
|
|
||||||
char path[PATH_MAX];
|
|
||||||
int pathlen = PATH_MAX;
|
|
||||||
FunctionCast(patched_cs_validate_page, orig_cs_validate)(vp, pager, page_offset, data, validated_p, tainted_p, nx_p);
|
|
||||||
- if (vn_getpath(vp, path, &pathlen) == 0 && UNLIKELY(strcmp(path, blueToolPath) == 0)) {
|
|
||||||
- searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
|
|
||||||
+ if (vn_getpath(vp, path, &pathlen) == 0) {
|
|
||||||
+ if (UNLIKELY(strcmp(path, blueToolPath) == 0)) {
|
|
||||||
+ searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
|
|
||||||
+ }
|
|
||||||
+ if (UNLIKELY(strcmp(path, bluetoothdPath) == 0)) {
|
|
||||||
+ if (brcm2046_patch) {
|
|
||||||
+ DBGLOG(MODULE_SHORT, "Patching BRCM2046 Hub into bluetoothd");
|
|
||||||
+ searchAndPatch(data, PAGE_SIZE, path, kBluetoothUSBNameOriginal, kBluetoothUSBNamePatched2046);
|
|
||||||
+ } else if (brcm2070_patch) {
|
|
||||||
+ DBGLOG(MODULE_SHORT, "Patching BRCM2070 Hub into bluetoothd");
|
|
||||||
+ searchAndPatch(data, PAGE_SIZE, path, kBluetoothUSBNameOriginal, kBluetoothUSBNamePatched2070);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Binary file not shown.
Reference in New Issue
Block a user