Contribute
Register

[FIX] BCM94352z DW1560 BT lost after sleep

Status
Not open for further replies.
Joined
Feb 15, 2018
Messages
53
Motherboard
HP > Need full model name > See Forum Rules!
CPU
i7-7700HQ
Graphics
HD 630 & GTX 1050
Mobile Phone
  1. Android
  2. iOS
Hello pals using BCM94352z:
I'm here to share the final solution I've found to the DUPLICATE DEVICE problem of BCM94352z, in the hope that it would help you.
This problem has been bothering me for a long time. I searched the whole Internet but got no clue. The most common advice is to adjust some delay values but it doesn't work for me :(

1. Problem symptoms:
After waking from sleep, sometimes BrcmPatchRAM2.kext might fail to upload firmware to BCM94352z, making Bluetooth unavailable. If you take a look at IOReg at this point, you'll find there're two BCM20702A0 devices listed under the same HSxx port. BrcmPatchRAM2 is attached to one of them, while the other is the real one labeled active. After this happens, no matter how many times you put your device into sleep again, BT will never restore to its full functionality.
403004



2. Problem essence:
*Note: I was using self-compiled debug version. (As you can see, I set the version to 3.0.0, just for fun :lol: ) If you use RehabMan-compiled release version instead, you'll see less information. However, you'll still be able to notice the "Not responding" log.
Before sleeping, I opened Console.app and started monitoring BrcmPatchRAM-related info. I found an interesting phenomenon:
Code:
default    21:18:42.318807 +0800    kernel    BrcmPatchRAM2: probe
default    21:18:42.318815 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
default    21:18:42.318841 +0800    kernel    BrcmPatchRAM: getFirmware
default    21:18:42.318845 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    21:18:42.419890 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
default    21:18:42.419902 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
default    21:18:42.421228 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
default    21:18:42.421235 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
default    21:18:42.421242 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
default    21:18:42.421246 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
default    21:18:42.421273 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
default    21:18:42.421277 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
default    21:18:42.421280 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    21:18:42.421316 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    21:18:42.421549 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
default    21:18:42.421561 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    21:18:42.421565 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
default    21:18:42.421568 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
default    21:18:42.421571 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    21:18:42.421805 +0800    kernel    BrcmPatchRAM2: got pipes
default    21:18:42.421810 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
default    21:18:42.440485 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
default    21:18:42.440495 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
default    21:18:42.440507 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
default    21:18:42.440514 +0800    kernel    BrcmPatchRAM: getFirmware
default    21:18:42.440520 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    21:18:42.441470 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
default    21:18:42.441487 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
default    21:18:43.056497 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
default    21:18:43.056509 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
default    21:18:43.358488 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Unknown event code (0xff).
default    21:18:43.358499 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
default    21:18:43.659513 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: RESET complete (status: 0x00, length: 4 bytes).
default    21:18:43.659540 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Reset complete".
default    21:18:43.660397 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device reset.
default    21:18:43.660556 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device status 0x00000003.
default    21:18:43.660564 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Reset complete" --> "Update complete".
default    21:18:43.660571 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware upgrade completed successfully.
default    21:18:43.662470 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 1 matching driver personalities.
default    21:18:43.662481 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Found existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    21:18:43.663897 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 2 matching driver personalities.
default    21:18:43.663904 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.no-one.BrcmPatchRAM2".
default    21:18:43.663908 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    21:18:43.663913 +0800    kernel    BrcmPatchRAM2: Processing time 1.345 seconds.
This is what a successful upload generates, while:
Code:
default    21:45:12.320848 +0800    kernel    BrcmPatchRAM2: probe
default    21:45:12.320858 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
default    21:45:12.320885 +0800    kernel    BrcmPatchRAM: getFirmware
default    21:45:12.320890 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    21:45:12.421263 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
default    21:45:12.421274 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
default    21:45:12.422757 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
default    21:45:12.422766 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
default    21:45:12.422771 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
default    21:45:12.422776 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
default    21:45:12.422791 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
default    21:45:12.422794 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
default    21:45:12.422797 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    21:45:12.422800 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    21:45:12.423058 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
default    21:45:12.423062 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    21:45:12.423065 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
default    21:45:12.423069 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
default    21:45:12.423072 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    21:45:12.423422 +0800    kernel    BrcmPatchRAM2: got pipes
default    21:45:12.423428 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
default    21:45:12.433043 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
default    21:45:12.433053 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
default    21:45:12.433064 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
default    21:45:12.433071 +0800    kernel    BrcmPatchRAM: getFirmware
default    21:45:12.433076 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    21:45:12.443044 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
default    21:45:12.443061 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
default    21:45:13.056522 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
default    21:45:13.056540 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
default    21:45:17.369918 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Not responding - Delaying next read.
default    21:45:17.369986 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
default    21:45:17.670438 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: device request failed ("0xe00002d8 (UNDEFINED)" 0xe00002d8).
default    21:45:17.670456 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: continuousRead - Failed to queue read (0xe00002d8)
this is a failed upload.
The difference begins from "Not responding" after which BrcmPatchRAM2 hangs.
From this I got the conclusion that the problem actually lies in BrcmPatchRAM2.kext and has nothing to do with DSDT, delays, USB configuration and things like those.

3.Problem origin
*Declaration: I know nothing about stuff like IOKit, so my description might be wrong. Correction is welcomed.
I downloaded the latest BrcmPatchRAM source code and located this "Not responding" info. This happens when HCI command HCI_RESET returns kIOReturnNotResponding. Tracking related code we'll finally come to this place:
C++:
            case kFirmwareWritten:
                IOSleep(mPreResetDelay);
                hciCommand(&HCI_RESET, sizeof(HCI_RESET);
                break;
This sends the failing HCI Command. However it lacks error-handling capabilities. If this operation fails, BrcmPatchRAM2 will never receive further instructions to proceed and, as a result, hangs.

4.SOLUTION
To handle this error, I changed the code here to:
C++:
            case kFirmwareWritten:
                IOSleep(mPreResetDelay);
                if (hciCommand(&HCI_RESET, sizeof(HCI_RESET)) != kIOReturnSuccess){
                    DebugLog("[Grid's mod] HCI_RESET failed, aborting.\n");
                    mDeviceState = kUpdateAborted;
                    continue;
                }
                break;
It means: when HCI_RESET fails (returns things other than kIOReturnSuccess), abort the upload process.
After this I compiled my modified version of BrcmPatchRAM2 and installed it.
*Note: To compile successfully, you'll have to first change Base SDK in XCode project settings to your version of MacOS.

5.Test
This is what occurs when HCI_RESET fails after I modified the code:
Code:
default    11:55:49.454646 +0800    kernel    BrcmPatchRAM2: probe
default    11:55:49.454660 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
default    11:55:49.454686 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:49.454692 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:49.454727 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
default    11:55:49.454736 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
default    11:55:49.455250 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
default    11:55:49.455258 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
default    11:55:49.455265 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
default    11:55:49.455272 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
default    11:55:49.455294 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
default    11:55:49.455298 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
default    11:55:49.455303 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:49.455307 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:49.455558 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
default    11:55:49.455562 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:49.455568 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
default    11:55:49.455571 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
default    11:55:49.455575 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:49.455831 +0800    kernel    BrcmPatchRAM2: got pipes
default    11:55:49.455841 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
default    11:55:49.466772 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
default    11:55:49.466784 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
default    11:55:49.466795 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
default    11:55:49.466802 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:49.466808 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:49.472788 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
default    11:55:49.472804 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
default    11:55:49.916795 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
default    11:55:49.916810 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
default    11:55:54.236359 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Not responding - Delaying next read.
default    11:55:54.236438 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
default    11:55:55.185262 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: device request failed ("0xe00002d8 (UNDEFINED)" 0xe00002d8).
default    11:55:55.185294 +0800    kernel    BrcmPatchRAM2: [Grid's mod] HCI_RESET failed, aborting.
default    11:55:55.185302 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "0xa (UNDEFINED)".
default    11:55:55.185312 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware upgrade failed.
default    11:55:55.187800 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 1 matching driver personalities.
default    11:55:55.187812 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Found existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:55.189399 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 2 matching driver personalities.
default    11:55:55.189406 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.no-one.BrcmPatchRAM2".
default    11:55:55.189411 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:55.189418 +0800    kernel    BrcmPatchRAM2: Processing time 5.286 seconds.
Now instead of hanging, BrcmPatchRAM2 aborts.
After that:
Code:
default    11:55:55.189418 +0800    kernel    BrcmPatchRAM2: Processing time 5.286 seconds.
default    11:55:55.194514 +0800    kernel    BrcmPatchRAM2: probe
default    11:55:55.194524 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
default    11:55:55.194543 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:55.194546 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:55.194563 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
default    11:55:55.194568 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
default    11:55:55.195037 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
default    11:55:55.195046 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
default    11:55:55.195053 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
default    11:55:55.195059 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
default    11:55:55.195075 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
default    11:55:55.195078 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
default    11:55:55.195081 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:55.195083 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:55.195329 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
default    11:55:55.195334 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:55.195338 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
default    11:55:55.195342 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
default    11:55:55.195345 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:55.195592 +0800    kernel    BrcmPatchRAM2: got pipes
default    11:55:55.195597 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
default    11:55:55.206183 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
default    11:55:55.206193 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
default    11:55:55.206203 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
default    11:55:55.206208 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:55.206212 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:55.211186 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
default    11:55:55.211201 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
default    11:55:55.620247 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
default    11:55:55.620283 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
default    11:55:56.122245 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Unknown event code (0xff).
default    11:55:56.122272 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
default    11:55:56.624371 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: RESET complete (status: 0x00, length: 4 bytes).
default    11:55:56.624413 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Reset complete".
default    11:55:56.625568 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device reset.
default    11:55:56.625754 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device status 0x00000003.
default    11:55:56.625762 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Reset complete" --> "Update complete".
default    11:55:56.625769 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware upgrade completed successfully.
default    11:55:56.627884 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 1 matching driver personalities.
default    11:55:56.627894 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Found existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:56.629344 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 2 matching driver personalities.
default    11:55:56.629351 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.no-one.BrcmPatchRAM2".
default    11:55:56.629356 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:56.629363 +0800    kernel    BrcmPatchRAM2: Processing time 1.434 seconds.
VOILA! The second attempt succeeded. Now BT is working again:clap:

-------------------------
I've created a fork on GitHub, read post #5. You can directly download the modified version (2.3.0) from the releases page.
 
Last edited:
Hello pals using BCM94352z:
I'm here to share the final solution I've found to the DUPLICATE DEVICE problem of BCM94352z.

1. Problem symptoms:
After waking from sleep, sometimes BrcmPatchRAM2.kext might fail to upload firmware to BCM94352z, making Bluetooth unavailable. If you take a look at ioreg at this point, you'll find there're two BCM20702A0 devices listed under the same HSxx port. BrcmPatchRAM is attached to one of them, while the other is the real one labeled active. After this happens, no matter how many times you put your device into sleep again, BT will never restore to its full functionality.
View attachment 403004


2. Problem essence:
Before sleeping, I opened Console.app and started monitoring BrcmPatchRAM-related info. I found an interesting phenomenon:
Code:
    21:18:42.318807 +0800    kernel    BrcmPatchRAM2: probe
    21:18:42.318815 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
    21:18:42.318841 +0800    kernel    BrcmPatchRAM: getFirmware
    21:18:42.318845 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
    21:18:42.419890 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
    21:18:42.419902 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
    21:18:42.421228 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
    21:18:42.421235 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
    21:18:42.421242 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
    21:18:42.421246 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
    21:18:42.421273 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
    21:18:42.421277 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
    21:18:42.421280 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
    21:18:42.421316 +0800    kernel    BrcmPatchRAM2: found matching endpoint
    21:18:42.421549 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
    21:18:42.421561 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
    21:18:42.421565 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
    21:18:42.421568 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
    21:18:42.421571 +0800    kernel    BrcmPatchRAM2: found matching endpoint
    21:18:42.421805 +0800    kernel    BrcmPatchRAM2: got pipes
    21:18:42.421810 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
    21:18:42.440485 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
    21:18:42.440495 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
    21:18:42.440507 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
    21:18:42.440514 +0800    kernel    BrcmPatchRAM: getFirmware
    21:18:42.440520 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
    21:18:42.441470 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
    21:18:42.441487 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
    21:18:43.056497 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
    21:18:43.056509 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
    21:18:43.358488 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Unknown event code (0xff).
    21:18:43.358499 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
    21:18:43.659513 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: RESET complete (status: 0x00, length: 4 bytes).
    21:18:43.659540 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Reset complete".
    21:18:43.660397 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device reset.
    21:18:43.660556 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device status 0x00000003.
    21:18:43.660564 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Reset complete" --> "Update complete".
    21:18:43.660571 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware upgrade completed successfully.
    21:18:43.662470 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 1 matching driver personalities.
    21:18:43.662481 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Found existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
    21:18:43.663897 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 2 matching driver personalities.
    21:18:43.663904 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.no-one.BrcmPatchRAM2".
    21:18:43.663908 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
    21:18:43.663913 +0800    kernel    BrcmPatchRAM2: Processing time 1.345 seconds.
This is what a successful upload generates, while:
Code:
    21:45:12.320848 +0800    kernel    BrcmPatchRAM2: probe
    21:45:12.320858 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
    21:45:12.320885 +0800    kernel    BrcmPatchRAM: getFirmware
    21:45:12.320890 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
    21:45:12.421263 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
    21:45:12.421274 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
    21:45:12.422757 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
    21:45:12.422766 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
    21:45:12.422771 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
    21:45:12.422776 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
    21:45:12.422791 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
    21:45:12.422794 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
    21:45:12.422797 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
    21:45:12.422800 +0800    kernel    BrcmPatchRAM2: found matching endpoint
    21:45:12.423058 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
    21:45:12.423062 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
    21:45:12.423065 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
    21:45:12.423069 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
    21:45:12.423072 +0800    kernel    BrcmPatchRAM2: found matching endpoint
    21:45:12.423422 +0800    kernel    BrcmPatchRAM2: got pipes
    21:45:12.423428 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
    21:45:12.433043 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
    21:45:12.433053 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
    21:45:12.433064 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
    21:45:12.433071 +0800    kernel    BrcmPatchRAM: getFirmware
    21:45:12.433076 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
    21:45:12.443044 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
    21:45:12.443061 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
    21:45:13.056522 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
    21:45:13.056540 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
    21:45:17.369918 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Not responding - Delaying next read.
    21:45:17.369986 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
    21:45:17.670438 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: device request failed ("0xe00002d8 (UNDEFINED)" 0xe00002d8).
    21:45:17.670456 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: continuousRead - Failed to queue read (0xe00002d8)
this is a failed upload.
The difference begins from "Not responding" after which BrcmPatchRAM2 hangs.
From this I got the conclusion that the problem actually lies in BrcmPatchRAM2.kext and has nothing to do with DSDT, delays, USB configuration and things like these.

3.Problem origin
*Declaration: I know nothing about IOKit, so my description might be wrong. Correction is welcomed.
I downloaded the latest BrcmPatchRAM source code and located this "Not responding" info. This happens when HCI command HCI_RESET returns kIOReturnNotResponding. Tracking related code we'll finally come to this place:
C++:
            case kFirmwareWritten:
                IOSleep(mPreResetDelay);
                hciCommand(&HCI_RESET, sizeof(HCI_RESET)
                break;
This sends the failing HCI Command. However it lacks error-handling capabilities. If this operation fails, no code is written to handle it. BrcmPatchRAM simply goes on and finally hangs.

4.SOLUTION
To handle this error, I changed the code here to:
Code:
            case kFirmwareWritten:
                IOSleep(mPreResetDelay);
                if (hciCommand(&HCI_RESET, sizeof(HCI_RESET)) != kIOReturnSuccess){
                    DebugLog("[Grid's mod] HCI_RESET failed, aborting.");
                    mDeviceState = kUpdateAborted;
                    continue;
                }
                break;
It means: when HCI_RESET fails (returns things other than kIOReturnSuccess), abort the upload process.
After this I compiled my modified version of BrcmPatchRAM2 and installed it.
*Note: to compile successfully, you'll have to first change Base SDK in XCode project settings to your version of MacOS.

5.Test
This is what occurs when HCI_RESET fails after I modified the code:
Code:
default    11:55:49.454646 +0800    kernel    BrcmPatchRAM2: probe
default    11:55:49.454660 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
default    11:55:49.454686 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:49.454692 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:49.454727 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
default    11:55:49.454736 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
default    11:55:49.455250 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
default    11:55:49.455258 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
default    11:55:49.455265 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
default    11:55:49.455272 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
default    11:55:49.455294 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
default    11:55:49.455298 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
default    11:55:49.455303 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:49.455307 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:49.455558 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
default    11:55:49.455562 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:49.455568 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
default    11:55:49.455571 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
default    11:55:49.455575 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:49.455831 +0800    kernel    BrcmPatchRAM2: got pipes
default    11:55:49.455841 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
default    11:55:49.466772 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
default    11:55:49.466784 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
default    11:55:49.466795 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
default    11:55:49.466802 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:49.466808 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:49.472788 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
default    11:55:49.472804 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
default    11:55:49.916795 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
default    11:55:49.916810 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
default    11:55:54.236359 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Not responding - Delaying next read.
default    11:55:54.236438 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
default    11:55:55.185262 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: device request failed ("0xe00002d8 (UNDEFINED)" 0xe00002d8).
default    11:55:55.185294 +0800    kernel    BrcmPatchRAM2: [Grid's mod] HCI_RESET failed, aborting.
default    11:55:55.185302 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "0xa (UNDEFINED)".
default    11:55:55.185312 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware upgrade failed.
default    11:55:55.187800 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 1 matching driver personalities.
default    11:55:55.187812 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Found existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:55.189399 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 2 matching driver personalities.
default    11:55:55.189406 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.no-one.BrcmPatchRAM2".
default    11:55:55.189411 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:55.189418 +0800    kernel    BrcmPatchRAM2: Processing time 5.286 seconds.
Now instead of hanging, BrcmPatchRAM2 aborts.
After that:
Code:
default    11:55:55.189418 +0800    kernel    BrcmPatchRAM2: Processing time 5.286 seconds.
default    11:55:55.194514 +0800    kernel    BrcmPatchRAM2: probe
default    11:55:55.194524 +0800    kernel    BrcmPatchRAM2: Version 3.0.0 starting on OS X Darwin 18.5.
default    11:55:55.194543 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:55.194546 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:55.194563 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: USB [C48E8FFA4A38 v274] "BCM20702A0" by "Broadcom Corp"
default    11:55:55.194568 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Available composite configurations: 1.
default    11:55:55.195037 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Set device configuration to configuration index 0 successfully.
default    11:55:55.195046 +0800    kernel    BrcmPatchRAM2: USBDeviceShim::findFirstInterface
default    11:55:55.195053 +0800    kernel    BrcmPatchRAM2: getValidatedInterface returns <private>
default    11:55:55.195059 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Interface 0 (class ff, subclass 01, protocol 01) located.
default    11:55:55.195075 +0800    kernel    BrcmPatchRAM2: set configuration and interface opened
default    11:55:55.195078 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 1, type = 3
default    11:55:55.195081 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:55.195083 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:55.195329 +0800    kernel    BrcmPatchRAM2: findPipe: direction = 0, type = 2
default    11:55:55.195334 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
default    11:55:55.195338 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
default    11:55:55.195342 +0800    kernel    BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
default    11:55:55.195345 +0800    kernel    BrcmPatchRAM2: found matching endpoint
default    11:55:55.195592 +0800    kernel    BrcmPatchRAM2: got pipes
default    11:55:55.195597 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Unknown" --> "Initialize".
default    11:55:55.206183 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
default    11:55:55.206193 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware version: v4096.
default    11:55:55.206203 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Initialize" --> "Firmware version".
default    11:55:55.206208 +0800    kernel    BrcmPatchRAM: getFirmware
default    11:55:55.206212 +0800    kernel    BrcmPatchRAM: Retrieved cached firmware for "BCM20702A1_001.002.014.1443.1572_v5668".
default    11:55:55.211186 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
default    11:55:55.211201 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware version" --> "Mini-driver complete".
default    11:55:55.620247 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: END OF RECORD complete (status: 0x00, length: 4 bytes).
default    11:55:55.620283 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Instruction write" --> "Firmware written".
default    11:55:56.122245 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Unknown event code (0xff).
default    11:55:56.122272 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Firmware written".
default    11:55:56.624371 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: RESET complete (status: 0x00, length: 4 bytes).
default    11:55:56.624413 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Firmware written" --> "Reset complete".
default    11:55:56.625568 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device reset.
default    11:55:56.625754 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Device status 0x00000003.
default    11:55:56.625762 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: State "Reset complete" --> "Update complete".
default    11:55:56.625769 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Firmware upgrade completed successfully.
default    11:55:56.627884 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 1 matching driver personalities.
default    11:55:56.627894 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: Found existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:56.629344 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: 2 matching driver personalities.
default    11:55:56.629351 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.no-one.BrcmPatchRAM2".
default    11:55:56.629356 +0800    kernel    BrcmPatchRAM2: [0a5c:216f]: existing IOKit personality "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport".
default    11:55:56.629363 +0800    kernel    BrcmPatchRAM2: Processing time 1.434 seconds.
VOILA! The second attempt succeeded. Now BT is working again:clap:

-------------------------
I don't know if it's ok to upload my modified version of BrcmPatchRAM2.kext. Would someone tell me?
If it's ok, I'll upload later.
Perhaps you should file a PR to RehabMan's repo with the fix.
 
@GridH magnificent investigation and findings!

BT-lost has been one of the most popular unsolved issues for hackintosh. People here are lacking of the skills or clues to solve...

w.r.t. your saying: "
*Note: to compile successfully, you'll have to first change Base SDK in XCode project settings to your version of MacOS."

would you or @RehabMan please upload a revised generic version of BrcmPatchRAM2.kext, which would also be suitable for High Sierra? I would like to test it on my High Sierra 10.13.2 for MacBookPro14,1.

To be honest, I have seen the doubled listing of BCM20702A0 after sleep and BT not working many times, esp. under System Report\hardware\USB, I thought the DSDT current(mA) setting for my 14,1 was not correct but have not clue... thanks for sharing your investigation and results!
 
Error handling isn't a bad thing by any means but this didn't fix the issue for me. Unfortunately, I still need the delay arguments as described in the kext readme, but this certainly does seem to be a piece to the puzzle. Thanks for your efforts!
 
would you or @RehabMan please upload a revised generic version of BrcmPatchRAM2.kext, which would also be suitable for High Sierra?
I've created a fork on GitHub: https://github.com/Grid-H/OS-X-BrcmPatchRAM
You can download it, change base SDK and deployment target to macOS 10.13 and compile it yourself.
In fact I only made a very small change...
To be honest, I have seen the doubled listing of BCM20702A0 after sleep and BT not working many times, esp. under System Report\hardware\USB, I thought the DSDT current(mA) setting for my 14,1 was not correct but have not clue...
Haha, at first I also thought it was a DSDT-related problem.
 
Unfortunately, I still need the delay arguments as described in the kext readme, but this certainly does seem to be a piece to the puzzle.
I've also experimented with different delay values previously but those settings didn't solve the problem. After adding the corresponding error-handling mechanism, I tried removing the boot-args. In my case, no boot-arg is required any longer.
Have you got rid of this problem in the end? If yes, I'm glad that my investigation helped.
 
I've also experimented with different delay values previously but those settings didn't solve the problem. After adding the corresponding error-handling mechanism, I tried removing the boot-args. In my case, no boot-arg is required any longer.
Have you got rid of this problem in the end? If yes, I'm glad that my investigation helped.

It was already fixed for me with the boot arguments alone, but I still have your fix applied because I think it can only help. Are you using the Release version? Or Debug?

**Edit -- And one other interesting side affect that I forgot to mention is that adding this completely eliminated my second stage boot glitch.
 
Last edited:
@GridH,

would you pls. remind me how to generate the debug info for BrcmPatchRAM2?
I would like to see if I could reproduce the output same as your in /var/log/system.log,
currently I tried "cat /var/log/system.log | grep -i brcm[fp]" but found nothing.
 
@GridH,

would you pls. remind me how to generate the debug info for BrcmPatchRAM2?
Read carefully. Use Console.app.
Note: You should use debug version instead of release version to see the details.
 
Status
Not open for further replies.
Back
Top