Skip to content

Commit

Permalink
Improved BlueToolFixup compatibility with macOS 12b10 (thx @dhinakg, @…
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Oct 22, 2021
1 parent dd3df1a commit 44c3025
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BrcmPatchRAM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@
D4F91AF51A2998CE0030D10D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
LastUpgradeCheck = 1300;
TargetAttributes = {
4C7783242526A08800DBB02E = {
CreatedOnToolsVersion = 12.0.1;
Expand Down
22 changes: 19 additions & 3 deletions BrcmPatchRAM/BlueToolFixup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ 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 char *blueToolPath = "/usr/sbin/BlueTool";
static const uint8_t kVendorCheckOriginal[] =
{
0x81, 0xFA, // cmp edx
0x5C, 0x0A, 0x00, 0x00, // Vendor BRCM,
0x74 // jnz short
};

static const uint8_t kVendorCheckPatched[] =
{
0x81, 0xFA, // cmp edx
0x5C, 0x0A, 0x00, 0x00, // Vendor BRCM,
0xEB // jmp short
};

static mach_vm_address_t orig_cs_validate {};

Expand All @@ -71,8 +83,12 @@ 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);
static constexpr size_t dirLength = sizeof("/usr/sbin/")-1;
if (vn_getpath(vp, path, &pathlen) == 0 && UNLIKELY(strncmp(path, "/usr/sbin/", dirLength) == 0)) {
if (strcmp(path + dirLength, "BlueTool") == 0)
searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
else if (strcmp(path + dirLength, "bluetoothd") == 0)
searchAndPatch(data, PAGE_SIZE, path, kVendorCheckOriginal, kVendorCheckPatched);
}
}

Expand Down
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
BrcmPatchRAM Changelog
======================
#### v2.6.1
- Improved BlueToolFixup compatibility with macOS 12b10 (thx @dhinakg, @williambj1)

#### v2.6.0
- Added BlueToolFixup for macOS 12 compatibility

Expand Down

1 comment on commit 44c3025

@MaximeH38
Copy link

@MaximeH38 MaximeH38 commented on 44c3025 Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's works on Mac OS 12.0.1 (21A558).
I can connect Headsets, Handoff works only one side, Continuity doesn't work. AirDrop works only one side (iPhone -> Hackintosh)
This problem is related to my Dell DW1550 WiFi Bluetooth combo card.
Your build is working properly.

I don't know where is the problem but I know this problem will eventually be corrected! 😁
Mac OS detect my bluetooth card as a Dongle (THIRD-PARTY-DONGLE) Product ID 0x0001 (how to change de product id? via a DSDT? It's possible with "DeviceProperties"?
Thanks you for your hard work everyone!❤️
(sorry for my bad English, I'm from France)
iOReg MacBook Air 22:10:2021.zip

Capture d’écran 2021-10-22 à 09 45 07
Capture d’écran 2021-10-22 à 09 45 28
Capture d’écran 2021-10-22 à 09 46 29
(In BRCMPatchRAM3 plist, the kext inject a BCM20702A1 firmware. And in the USB section on my system information my bluetooth card is recognized as BCM20702A0. It's an issue?)

Please sign in to comment.