Oh dear,
I am very new to all this - first time to Xcode- so please forgive.
Made some rookie judgment errors.
Turns out the reason why the tluck version (BRCMPatchRam2) was running well on my system because it was running in debug - which I should have considered also slows down the kext. (DUH)
So when I reduced tluck's version to that 1 line change, and it worked , it was only because it was running debug.
When running tluck in release : it did not work (not even with all changes)
When I run your version in debug (RehabMan 16/2/16) it works.
So it was back to the drawing board.
what I did to find out which debuglog_message was allowing the firmware to load I did the following.
First I had a look at the logs when the release version fails
Code:
12129:2018-05-02 10:57:31.644507+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Version 2.2.7 starting on OS X Darwin 16.7.
12284:2018-05-02 10:57:31.850946+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Unknown new Darwin version 16.7, using possible compatible personality.
12290:2018-05-02 10:57:31.853244+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Published new IOKit personality for BrcmFirmwareStore.
12291:2018-05-02 10:57:31.853464+1000 0x443 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Firmware store start
12292:2018-05-02 10:57:31.859546+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Published new IOKit personality for BrcmPatchRAMResidency.
12293:2018-05-02 10:57:31.864973+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: getFirmware
12294:2018-05-02 10:57:31.865600+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: loadFirmware
12295:2018-05-02 10:57:31.872049+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource: 00000000
12843:2018-05-02 10:57:32.374505+1000 0x210 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource Callback: dc008006.
12844:2018-05-02 10:57:32.381461+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource: 00000000
12857:2018-05-02 10:57:32.403433+1000 0x210 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource Callback: dc008006.
12858:2018-05-02 10:57:32.410492+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource: 00000000
12876:2018-05-02 10:57:32.420377+1000 0x210 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource Callback: 5886 bytes of data.
12880:2018-05-02 10:57:32.427691+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Loaded firmware "BCM4350C5_003.006.007.0095.1703_v5799.zhx" from resources.
12883:2018-05-02 10:57:32.435824+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Decompressed firmware (5886 bytes --> 14872 bytes).
12886:2018-05-02 10:57:32.443338+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Firmware is valid IntelHex firmware.
12890:2018-05-02 10:57:32.450408+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: USB [ACE010DD2F5E v274] "BCM2045A0" by "Broadcom Corp"
13906:2018-05-02 10:57:33.462377+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: getFirmware
13907:2018-05-02 10:57:33.469687+1000 0x37b Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Retrieved cached firmware for "BCM4350C5_003.006.007.0095.1703_v5799".
20415:2018-05-02 10:57:37.998381+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: device request failed ("0xe00002ed (UNDEFINED)" 0xe00002ed).
20433:2018-05-02 10:57:38.013212+1000 0x115 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Not responding - Delaying next read.
20449:2018-05-02 10:57:38.025406+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: device request failed ("0xe00002ed (UNDEFINED)" 0xe00002ed).
20465:2018-05-02 10:57:38.038176+1000 0x115 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Not responding - Delaying next read.
20472:2018-05-02 10:57:38.049063+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: device request failed ("0xe00002ed (UNDEFINED)" 0xe00002ed).
20473:2018-05-02 10:57:38.062203+1000 0x115 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Not responding - Delaying next read.
20474:2018-05-02 10:57:38.072766+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: device request failed ("0xe00002ed (UNDEFINED)" 0xe00002ed).
20475:2018-05-02 10:57:38.085285+1000 0x115 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Not responding - Delaying next read.
20476:2018-05-02 10:57:38.095181+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: device request failed ("0xe00002ed (UNDEFINED)" 0xe00002ed).
20477:2018-05-02 10:57:38.108257+1000 0x115 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Not responding - Delaying next read.
20478:2018-05-02 10:57:38.120896+1000 0x37b Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: device request failed ("0xe00002ed (UNDEFINED)" 0xe00002ed).
then I had a look at the debug_log when it succeeds
Code:
2013:2018-05-02 10:46:41.600374+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: probe
2016:2018-05-02 10:46:41.601406+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Version 2.2.7 starting on OS X Darwin 16.7.
2183:2018-05-02 10:46:41.802602+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Unknown new Darwin version 16.7, using possible compatible personality.
2185:2018-05-02 10:46:41.803925+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: 1 matching driver personalities for BrcmFirmwareStore.
2187:2018-05-02 10:46:41.805693+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Published new IOKit personality for BrcmFirmwareStore.
2188:2018-05-02 10:46:41.805948+1000 0x437 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Firmware store start
2195:2018-05-02 10:46:41.811397+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: 1 matching driver personalities for BrcmPatchRAMResidency.
2200:2018-05-02 10:46:41.812512+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: Published new IOKit personality for BrcmPatchRAMResidency.
2201:2018-05-02 10:46:41.812736+1000 0x43d Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: BrcmPatchRAMResidency start
2211:2018-05-02 10:46:41.818610+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: getFirmware
2248:2018-05-02 10:46:41.851641+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: loadFirmware
2249:2018-05-02 10:46:41.851871+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource: 00000000
2989:2018-05-02 10:46:42.670097+1000 0x20f Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource Callback: dc008006.
3000:2018-05-02 10:46:42.677657+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource: 00000000
3087:2018-05-02 10:46:42.706528+1000 0x20f Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource Callback: dc008006.
3096:2018-05-02 10:46:42.715894+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource: 00000000
3106:2018-05-02 10:46:42.726648+1000 0x20f Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: OSKextRequestResource Callback: 5886 bytes of data.
3113:2018-05-02 10:46:42.735730+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Loaded firmware "BCM4350C5_003.006.007.0095.1703_v5799.zhx" from resources.
3126:2018-05-02 10:46:42.744603+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Decompressed firmware (5886 bytes --> 14872 bytes).
3136:2018-05-02 10:46:42.753304+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Firmware is valid IntelHex firmware.
3144:2018-05-02 10:46:42.762414+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: USB [ACE010DD2F5E v274] "BCM2045A0" by "Broadcom Corp"
3616:2018-05-02 10:46:43.172962+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Available composite configurations: 1.
3626:2018-05-02 10:46:43.181727+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Set device configuration to configuration index 0 successfully.
3632:2018-05-02 10:46:43.190619+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: USBDeviceShim::findFirstInterface
3638:2018-05-02 10:46:43.198359+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: getValidatedInterface returns <private>
3642:2018-05-02 10:46:43.213381+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Interface 0 (class ff, subclass 01, protocol 01) located.
3649:2018-05-02 10:46:43.229721+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: set configuration and interface opened
3667:2018-05-02 10:46:43.249192+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: findPipe: direction = 1, type = 3
3672:2018-05-02 10:46:43.257528+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
3673:2018-05-02 10:46:43.266100+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: found matching endpoint
3674:2018-05-02 10:46:43.274301+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: findPipe: direction = 0, type = 2
3693:2018-05-02 10:46:43.283606+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 3
3694:2018-05-02 10:46:43.294823+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: endpoint found: epDirection = 1, epType = 2
3695:2018-05-02 10:46:43.303616+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: endpoint found: epDirection = 0, epType = 2
3702:2018-05-02 10:46:43.313296+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: found matching endpoint
3705:2018-05-02 10:46:43.322497+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: got pipes
3978:2018-05-02 10:46:43.930117+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Unknown" --> "Initialize".
3997:2018-05-02 10:46:43.939515+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: READ VERBOSE CONFIG complete (status: 0x00, length: 10 bytes).
4010:2018-05-02 10:46:43.948764+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Firmware version: v4096.
4016:2018-05-02 10:46:43.956994+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Initialize" --> "Firmware version".
4025:2018-05-02 10:46:43.965703+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: getFirmware
4028:2018-05-02 10:46:43.973098+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Retrieved cached firmware for "BCM4350C5_003.006.007.0095.1703_v5799".
4044:2018-05-02 10:46:43.982505+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
4070:2018-05-02 10:46:43.991676+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Firmware version" --> "Mini-driver complete".
6201:2018-05-02 10:46:44.481546+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: END OF RECORD complete (status: 0x00, length: 4 bytes).
6202:2018-05-02 10:46:44.490506+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Instruction write" --> "Firmware written".
6277:2018-05-02 10:46:44.569509+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: RESET complete (status: 0x00, length: 4 bytes).
6278:2018-05-02 10:46:44.578007+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Firmware written" --> "Reset complete".
6292:2018-05-02 10:46:44.587237+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Device reset.
6322:2018-05-02 10:46:44.594886+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Device status 0x00000003.
6329:2018-05-02 10:46:44.602720+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Reset complete" --> "Update complete".
6334:2018-05-02 10:46:44.611086+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Firmware upgrade completed successfully.
6341:2018-05-02 10:46:44.620417+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: brcmBundIdentifier: "com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport"
6354:2018-05-02 10:46:44.629368+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: brcmIOClass: "BroadcomBluetoothHostControllerUSBTransport"
6409:2018-05-02 10:46:44.637795+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: brcmProviderClass: "IOUSBHostDevice"
You can compare the two and see where it fails (Device request failed - repeatedly ---).
look at this
View attachment 329010
and compare to this
View attachment 329011
So you can see that the fault happens right after
Code:
Retrieved cached firmware for "BCM4350C5_003.006.007.0095.1703_v5799".
now in the working version after that line "retrieved cached firmware" you get these
Code:
028:2018-05-02 10:46:43.973098+1000 0x376 Default 0x0 0 kernel: (BrcmFirmwareRepo) BrcmPatchRAM: Retrieved cached firmware for "BCM4350C5_003.006.007.0095.1703_v5799".
4044:2018-05-02 10:46:43.982505+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
4070:2018-05-02 10:46:43.991676+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Firmware version" --> "Mini-driver complete".
6201:2018-05-02 10:46:44.481546+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: END OF RECORD complete (status: 0x00, length: 4 bytes).
6202:2018-05-02 10:46:44.490506+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Instruction write" --> "Firmware written".
6277:2018-05-02 10:46:44.569509+1000 0x112 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: RESET complete (status: 0x00, length: 4 bytes).
6278:2018-05-02 10:46:44.578007+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: State "Firmware written" --> "Reset complete".
6292:2018-05-02 10:46:44.587237+1000 0x376 Default 0x0 0 kernel: (BrcmPatchRAM2) BrcmPatchRAM2: [0a5c:6412]: Device reset
so I looked at the code where
Code:
DOWNLOAD MINIDRIVER complete (status: 0x00, length: 4 bytes).
was a debuglog
here is where I found them
View attachment 329013
so I changed three debuglog (HCI_OPCODE_END_OF_RECORD, HCI_OPCODE_RESET, HCI_OPCODE_DOWNLOAD MINIDRIVER) to always log - and create a release version to run.
this worked.
So then it was a matter of elimination to see which one was absolutely necessary.
all this is very time consuming of course .
so by elimination I found out that if I only changed one debuglog (HCI_OPCODE_END_OF_RECORD) to always log - the firmware would load.
So then an added a iosleep (20) was enough to make the release work (after changing alwayslog back to debuglog)
View attachment 329014
so this made it work consistently for my Dell - DW1820..
Not sure if this delay is put in a good place - but at least it works for now -
Is there a better place to put this iosleep achieving the same thing?
Sorry again for creating some confusion with tluck version which turned out not to be my solution.