Fix Monterey Bluetooth

This commit is contained in:
Mykola Grymalyuk
2021-09-16 10:06:59 -06:00
parent 950f645f02
commit 1da93b1ca0
9 changed files with 145 additions and 5 deletions

View File

@@ -948,7 +948,25 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<string>16.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>BlueToolFixup.kext</string>
<key>Comment</key>
<string>Fix Monterey Bluetooth</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/BlueToolFixup</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>21.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>

Binary file not shown.

View File

@@ -0,0 +1,26 @@
diff --git a/BrcmPatchRAM/BlueToolFixup.cpp b/BrcmPatchRAM/BlueToolFixup.cpp
index 0fa891a..e68f28e 100644
--- a/BrcmPatchRAM/BlueToolFixup.cpp
+++ b/BrcmPatchRAM/BlueToolFixup.cpp
@@ -50,7 +50,11 @@ 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 kBluetoothUSBNamePatched[] = "BRCM2046 Hub Host Controller";
+
static const char *blueToolPath = "/usr/sbin/BlueTool";
+static const char *bluetoothdPath = "/usr/sbin/bluetoothd";
static mach_vm_address_t orig_cs_validate {};
@@ -74,6 +78,9 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o
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 && UNLIKELY(strcmp(path, bluetoothdPath) == 0)) {
+ searchAndPatch(data, PAGE_SIZE, path, kBluetoothUSBNameOriginal, kBluetoothUSBNamePatched);
+ }
}

Binary file not shown.

View File

@@ -0,0 +1,26 @@
diff --git a/BrcmPatchRAM/BlueToolFixup.cpp b/BrcmPatchRAM/BlueToolFixup.cpp
index 0fa891a..6a9d2f3 100644
--- a/BrcmPatchRAM/BlueToolFixup.cpp
+++ b/BrcmPatchRAM/BlueToolFixup.cpp
@@ -50,7 +50,11 @@ 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 kBluetoothUSBNamePatched[] = "BRCM2070 Hub Host Controller";
+
static const char *blueToolPath = "/usr/sbin/BlueTool";
+static const char *bluetoothdPath = "/usr/sbin/bluetoothd";
static mach_vm_address_t orig_cs_validate {};
@@ -74,6 +78,9 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o
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 && UNLIKELY(strcmp(path, bluetoothdPath) == 0)) {
+ searchAndPatch(data, PAGE_SIZE, path, kBluetoothUSBNameOriginal, kBluetoothUSBNamePatched);
+ }
}