Back in September 2013 I blogged about my findings for the Haswell HDAU solution. Not that I needed it, since I don’t even own a HDMI monitor, but back then nobody solved the puzzle so I took on the challenge and went looking for a solution. This time around it was a lot easier, because now we know what to patch :-)
Yes. Maybe I should have stopped here, but I didn’t. No. I did not cut corners but instead I went in deep and looked for a simple solution. One that doesn’t require Xcode (for nm and otool) and only uses three command line tools (grep, perl and xxd).
There was also another reason why I did it: I admire people like Toleda who commit their fee time, and energy, to help us to get audio going. Right. My work here is only facilitating a small part of his excellent work for our community. And you know what. Most of us would be nowhere without his help, so don’t forget to say thanks when you use his work. And I know that I do so here goes:
Thank you David!
My late sister Sam was also involved, because Sam figured out how we can extract and repack the audio resource files (xml.zlib). And let me tell you this. It’s been two year since her passing, but we still feel the emptiness. Even today I am trying to get over it, and the last two weeks have been particularity hard for me. That was also why I went quite. I just needed some time for myself and my family.
Proof Of Concept
Ok. With that set aside I like to share something with you that has been confirmed to work for Yosemite. Just a few lines of code taken from a script that I am working on, but this made it work for Toleda:
1) xxd -ps AppleHDAController | tr -d ‘\n’ > /tmp/AppleHDAController.txt
2) /usr/bin/perl -pi -e ‘s|3d0c0a0000740e3d0c0d00|3d0c0a0000740e3d0c0c00|g’ /tmp/AppleHDAController.txt
3) /usr/bin/perl -pi -e ‘s|3d0c0a00000f84830100003d0c0d00|3d0c0a00000f84830100003d0c0c00|g’ /tmp/AppleHDAController.txt
4) /usr/bin/perl -pi -e ‘s|3d0c0a0000745ee9180100003d0b0d00007f103d0c0c00000f8496000000|3d0c0a0000745ee9180100003d0b0d00007f103d0c0c0000744b90909090|g’ /tmp/AppleHDAController.txt
5) xxd -r -p /tmp/AppleHDAController.txt /tmp/AppleHDAController
This way you won’t have to wait – I can be really busy at times – and can you enjoy HDMI audio like before.
Edit: I f*cking hate it when wordpress.com thinks to be smart and “correct” my text, with text that does not make sense.
I like to add a clarification. Let’s start with the binary patch that I used to patch the first Developer Preview of 10.9, which by the way should still work with Yosemite:
/usr/bin/perl -pi -e ‘s|3d0c0a0000|3d0c0c0000|g’ /tmp/AppleHDAController.txt
All it does is that it changes the cmp eax, 0xa0c instruction in AppleHDAController:edidIsValidForAudio() and AppleHDAController:gfxMatchedHandler() into cpm eax, 0xc0c.
This part however did not make it into AppleHDA8Series.sh because of two reasons. First. HDMI audio worked without this patch but more importantly, perl failed to patch data with patterns with \x0a (think form feed) in it. That is also why I changed a jmp instruction. Simply because that worked in AppleHDA8Series.sh
This is perfectly fine for Chameleon and Chimera, since that cannot patch AppleHDAController, but Clover can, and since Dimitry uses Clover… he had to figure out a way that did not require re-calculation of the jump address that I changed. And he did, but only after I solved the puzzle. Still. All credit goes to Dimitri for figuring out his alternative (one part of the patch instruction). Which has to be said, fair is fair, is much better suited Clover and RevoBoot users.
Now back to AppleHDA8Series.sh because my next update will be able to do the calculation for you, and that won’t check two, but only one codec ID. Something that is still impossible with Clover. In the end it’s all the same. HDMI audio works… but now we have yet another way of patching files. Something that previously failed to work for me ;)