Jump to content
Welcome to InsanelyMac Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 
bcc9

Script to patch AppleHDA binary for osx10.7/10.8/10.9

166 posts in this topic

Recommended Posts

now everyone has a point of reference for HDA binary patching, thank you very much for this Topic!

Thanks, hope it works out that way. It can if the codec list gets further contributions.

 

Share this post


Link to post
Share on other sites

The OSx86 scene has a new data collection point, and a powerful tool.

All who will use your script, I hope will give credit to this Topic in the web! ;)

 

Micky

 

Thanks, hope it works out that way. It can if the codec list gets further contributions.

According to you, the user, based on what evidence should choose a replacement for a specific codec?

Looking into AppleHDA, in the different layouts and their respective patmaps, we can guess how they work, but this can be of help in finding the right codec replacement?

 

Micky

Share this post


Link to post
Share on other sites

According to you, the user, based on what evidence should choose a replacement for a specific codec?

Looking into AppleHDA, in the different layouts and their respective patmaps, we can guess how they work, but this can be of help in finding the right codec replacement?).

The codec replacements are fairly predictable - mostly all codecs from a particular vendor map to the same codec vendor within AppleHDA (for example almost all IDT codecs work with the ADI codec code, realtek work with ALC, etc.). Some experimentation is often required (trying both ADI1984 and ADI 1984B for example).

Since the hardware vendors seem to be basing their codecs off of each other, there are a lot of similarities between vendors. To dig deeper, one can always look at the ALSA open source code and see what quirks exist for a particular codec and what other codec(s) have comparable widget/amp driver support.

Share this post


Link to post
Share on other sites

Hi Bcc this look promising and a very great idea. I have just downloaded script 0.8 and there happens to be a set of errors throwing out here.

 

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 320, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 322, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 324, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 326, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 328, near ") exit"

 

Doesn't matter if you run the patch-hda.pl or patch-hda same error.

Share this post


Link to post
Share on other sites

Hi Bcc this look promising and a very great idea. I have just downloaded script 0.8 and there happens to be a set of errors throwing out here.

 

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 320, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 322, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 324, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 326, near ") exit"

syntax error at /users/solidus1983/desktop/AudioPatching/hda/patch-hda.pl line 328, near ") exit"

 

Doesn't matter if you run the patch-hda.pl or patch-hda same error.

Damn, I swear I had tested that last minute change before posting 0.8. Fixed now, version 0.9. Duh.

 

 

Share this post


Link to post
Share on other sites

Thats ok bcc9. I looked in the script and its a great idea what you are doing its just a shame there is no way you can get the script to do everything for you. I.e mod the Platforms.xml.zlib Layoutxx.xml.zlib and info.plist automatically with everything needed to get the sound working.

 

Will try version 0.9 tonight.!

Share this post


Link to post
Share on other sites

Perhaps someone would like to take the codec dump from alsa, parse it, and generate a candidate, or template, layout&pathmap xml for AppleHDA. Then a database of modifications to make on top of that and you'd have something.

 

Share this post


Link to post
Share on other sites

Perhaps someone would like to take the codec dump from alsa, parse it, and generate a candidate, or template, layout&pathmap xml for AppleHDA. Then a database of modifications to make on top of that and you'd have something.

Something similar to the pre-defined templates where adding a new device (in Layoutxx.xml), and shares can be copied from a plist file ready to be pasted in a different sub in PathMaps?

 

 

layout121.png

 

 

Platforms.xlm

platforms3.pngplatforms4.png

 

 

 

Micky

Share this post


Link to post
Share on other sites

Something like that. With a program/script, one could compute the directed graph of nodes to use in the pathmap instead of having a user input them manually. Basically implement the dynamic configuration detection from the alsa driver but instead of doing so as a driver, make the output just be xml for AppleHDA, and the input be the codec dump from alsa.

 

 

Share this post


Link to post
Share on other sites

Thats the main issue i have, I have the Codec Verbs not a problem i look at the pinout and its a brain mess for me.

 

A script that could say do the Verb and Read the SVG file then parse it to .xml would be great. But how one can do that i don't know.

 

From reading the how too's the main issue really is layout and platforms.xml thats where most get stuck.

Share this post


Link to post
Share on other sites

Something like that. With a program/script, one could compute the directed graph of nodes to use in the pathmap instead of having a user input them manually. Basically implement the dynamic configuration detection from the alsa driver but instead of doing so as a driver, make the output just be xml for AppleHDA, and the input be the codec dump from alsa.

edit/deploy on codecgraph and verbit? would be nice ....but who do this? :whistle: ======|>

bcc9 :wink2:

 

 

Micky

Share this post


Link to post
Share on other sites

A script that could say do the Verb and Read the SVG file then parse it to .xml would be great. But how one can do that i don't know.

Or maybe just use the alsa codec dump parsing code from codecgraph that generates a .svg as a starting point for a new tool that generates xml instead.

 

edit/deploy on codecgraph and verbit? would be nice ....but who do this? :whistle: ======|>

bcc9 :wink2:

 

Ha, it was by design that I only tackled the easier part of patching the AppleHDA binary. I don't have time to take on the more ambitious project.

 

Actually I'm kind of surprised that by now AppleHDA itself hadn't been cleaned up to work without any static xml codec config.

 

Micky your a classic. Problem is how can one parse a .svg file how ever i have found this http://www.kernel.or...sa/HD-Audio.txt interesting read though.

The HDA audio spec http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/high-definition-audio-specification.pdf is also mandatory background reading for such a project.

Share this post


Link to post
Share on other sites

A really quality post.

I have corrected some AppleHDA for ALC272, ALC270 and others.

What I have to do so that you can include these codecs in your script?

Share this post


Link to post
Share on other sites

A really quality post.

I have corrected some AppleHDA for ALC272, ALC270 and others.

What I have to do so that you can include these codecs in your script?

You must publish what codec you have patched, and what did you replace on the binary.

Of course you tried and have seen if it work in Mountain Lion.

If you read above, instances of change in AppleHDA binary, can change between Lion and Mountain Lion (read the "range comparisons" at first post):

only way is to tell bcc9, "I tried it, and it works!"

 

 

Micky1979

Share this post


Link to post
Share on other sites

You must publish what codec you have patched, and what did you replace on the binary.

Exactly. Presumably the changes are a few added lines to patch-hda-codecs.pl, and you can either just post the lines you added or the whole new version, and I'll add them to the .zip.

Seems like a default wildcard for realtek codecs: 10ec:* => alc885 might be in order.

 

 

 

 

 

Share this post


Link to post
Share on other sites

Exactly. Presumably the changes are a few added lines to patch-hda-codecs.pl, and you can either just post the lines you added or the whole new version, and I'll add them to the .zip.

Seems like a default wildcard for realtek codecs: 10ec:* => alc885 might be in order.

In the case of ALC272, 270 I applied the patch in ADI1984 ie the same thing that your script makes for ALC269 on lion replaces 8419d11 to 6902ec10 and zeroed the ALC884 ie 8408ec10 to 00000000 and it worked like a charm. in Mountain lion and Lion.

Share this post


Link to post
Share on other sites

 

In the case of ALC272, 270 I applied the patch in ADI1984 ie the same thing that your script makes for ALC269 on lion replaces 8419d11 to 6902ec10 and zeroed the ALC884 ie 8408ec10 to 00000000 and it worked like a charm. in Mountain lion and Lion.

Not clear *exactly* what changes you're proposing for patch-hda-codecs.pl. You mention alc272 & alc270 which I should think would be 10ec0272 & 10ec0270 but you only list one target hex value that doesn't match either of those.

Again, if you want to post the lines you added to the script or the whole new version, I can add them to the copy in post #1.

 

Share this post


Link to post
Share on other sites

Not clear *exactly* what changes you're proposing for patch-hda-codecs.pl. You mention alc272 & alc270 which I should think would be 10ec0272 & 10ec0270 but you only list one target hex value that doesn't match either of those.

Again, if you want to post the lines you added to the script or the whole new version, I can add them to the copy in post #1.

 

 

bcc9 hi, well I did this in two ways:

1-I ran your script to correct ALC269 (0x10ec0269) then after replacing the line already corrected for 6902ec10 to 7002ec10 (ALC270) it worked for ALC272.

both codecs worked well.

2-I just changed the line ADI1984 (0x11d41984) for ALC270, ALC269 and zeroed checking 84 08 ec 10 worked very well.

Share this post


Link to post
Share on other sites

bcc9 hi, well I did this in two ways:

1-I ran your script to correct ALC269 (0x10ec0269) then after replacing the line already corrected for 6902ec10 to 7002ec10 (ALC270) it worked for ALC272.

both codecs worked well.

2-I just changed the line ADI1984 (0x11d41984) for ALC270, ALC269 and zeroed checking 84 08 ec 10 worked very well.

I'm still not sure I understand your writing.

I think what you mean is that we should add:

    { name => 'Realtek ALC270',
     target_id => 0x10ec0270,
     patch_id => 0x11d41984        #ADI 1984
   },
   { name => 'Realtek ALC272',
     target_id => 0x10ec0272,
     patch_id => 0x11d41984        #ADI 1984
   },

to patch-hda-codecs.pl

?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.



×