As the topic name sad I'm trying to make a database with all info/tips needed on patching AppleHDA.kext Please don't ask here for patched kexts or anything else, try to keep this topic just for info!
For that use StickpinLegacy Audio Plist Only Kexts or ask for help on MadTuxPatching HDA Topic
1. First step --> Linux Codec Dump
-Itis a must for start patching applehda.kext, my advice use latest linuxdistro you can find, dump it and save it in a safe place! *NewSince I found some errors in ubuntu dumps I advice you to usemandriva-linux-one-2009-KDE4-int-cdrom-i586 to make the dumps, you willget a clean codecgraph w/o errors b/c mandriva use latest alsadrivers...
2. Convert all hex data from codec dump using Munky ruby script
-Sinceinfo.plist's from AppleHDAPlatformDriver dosent use any hex value, tofigure out what we need to change/add in plist we must have all valuein decimal
-We still need dump in hex format for verb creation to put it on AppleHDAController ConfigData
Thanks a lot to munky who made that convert script now its more easy to do this in just a few steps w/o any mistakes!
Alsohe helped me(I'm a linux n00b) to understand and use some great scriptsfrom linux that will create for you using the codec dump a codecgraphfor better understanding on how works that codec and also to have allpin and connections in one picture!
Read bellow how to:
a. To just convert hex to dec:
QUOTE(munky @ Sep 30 2008, 04:43 PM)
Attaching a ruby script which will convert the hex values to decimal.
Usage,make a folder to your dektop named as example "codecgraph", put allfiles, scripts and dump in that folder, then open Terminal and type:
Cd to your folder:
cd /Users/theking/Desktop/codecgraph <--- Replace "theking" with your user
chmod +x ./convert_hex_to_dec.rb
Then type: ./convert_hex_to_dec.rb dumpfile.txt <--- dumpfile.txt=your codec dump txt file as ex alc***.txt
it will output to stdout. if you want u can pipe it to a file with:
./convert_hex_to_dec.rb dumpfile.txt > /Users/theking/Desktop/codecgraph/ConvertedDumpfile.txt <--- Replace "theking" with your user
*Edited for better n00b understanding
b. To create codec graph and after that convet hex data to dec:
Requirements:
- Download and install MacPorts
- make sure u are connected to internet, open terminal and type: sudo /opt/local/bin/port install graphviz -wait until it finish, it takes some times(more then 10-15 min)!
- after install is done and u got this last mesg: ---> Cleaning graphviz type in terminal(press enter after each line): cd
then type: nano .profile
copy/paste this line in terminal: export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Then press ctrl+x
type y
then enter
Jobe is done, close and open terminal again for the next step:
- Download CodecGraph*Tip look first on already uploaded codec graphs, on the main site, ifyou codec is already there(specific hw also!) then u are lucky and udon't need to make a new one, just skip the *** part and justconvert hex to dec for easy undestanding and plist modd.
- unzip itto desktop and rename the folder to codecgraph(also rename your codecdump to just 1 name if it have more, like alc***.txt), put your codecdump in the same folder
- now in terminal cd to your codecgraph folder example: cd /Users/theking/Desktop/codecgraph
- then type: ./codecgraph /Users/theking/Desktop/codecgraph/M50SV.txt *replace "theking" & "M50SV.txt" with your user and codec name file
If u get some errors messg like " Node 0x14: Amp-In vals count is wrong: values found: 5. expected: 1" just ignore them.
-Now u should have in the codecgraph folder a file alc***.txt.svg <-- thats the codec graph
If u like to see it open it with safari or firefox, looks nice isn't it?
-Now the final step converting hex data from alc***.txt.svg to dec:
just follow the steps as munky described ^^^ and use his script to convert it, just use instead codec dump --> alc***.txt.svg
Jobe is done!
How to "read" codecgraph?
Read bellow:
Node shape and colors:
Amplifier: ***
Audio input: red ellipse
Audio output: blue ellipse
Audio selector: parallelogram
Audio mixer: hexagon
Pin complex: rectangle
Hereu have my codec graph for ASUS M50SV Notebook, I opened the converted.svg in Adobe Ilustrator and save it as .psd(dont chose more then 150dpi unless if u have more then 4 GB of ram and a strong CPU), afterthat I open it in Photoshop and add colors on my laptop connections foreasy understanding...:
3. Read ---> Taruga AppleHDA Patching GUIDE
-It's a bit old but helps a lot to make a idea on what we have to do!
Theonly difference is that on Leopard applehda.kext there is no need tomodd main info.plist(not sure about hex hack, for me works w/o it)
What we have to modd is: AppleHDAPlatformDriver.kext & AppleHDAController.kext plist's.
4. Getting the right PIN Configuration
Color Jack description
Pink Microphone input
Blue Line input
Green Front-left and front-right speakers
Orange Center speaker and subwoofer
Black Back-left and back-right speakers
Gray Side-left and side-right speakers
White Pin connecting to analog RCA jacks
Green Front panel headphones
*Audio Jack Color Coding from Intel Pin Configuration Guidelines for High Definition Audio Devices
Assumingthat you read Taruga's GUIDE you know now what means that terms, usingconverted linux codec dump you can easy find the right pins.
Here is example for ALC888 S/T(PIN are bold):
Internal Mic (Pink): 8 35 25
Mic (Pink): 9 34 24
Line in (Blue): 8 35 26
Front (Green): 20 12 2 *[FIXED] SPEAKER AT INT ATAPI on my lappie
Rear (Black): 21 13 3
Sub/Center (Orange): 22 14 4
Side (Red): 23 15 5
Headphones: 27 38 37 *[JACK] HP OUT AT EXT REAR I set it as 27 12 2 on my lappie
SPDIF IN: 10 31
SPDIF OUT: 30 6
This example could work for other codecs too, dunno for sure but you can check your converted dump values like this:
NODE 9 [AUDIO INPUT] WCAPS 1048859: STEREO AMP-IN , you will see CONNECTION: 1 -->34 Then if you look on : NODE 24[PIN COMPLEX] WCAPS 4194703: STEREO AMP-IN AMP-OUT it will tell youwhat it is [JACK] MIC AT EXT REAR This setup external mic as example.
5. Editing AppleHDAController Info.Plist
Well here I have most problems/terms that I don't understand, if you know more then me please share
-First,always use Property List Editor(you can find it in xcode) or PlistEditPro to edit/change the info.plist's, this will prevent errors and keepthe things clear!
-Second, if Taruga already made a hacked kext for your codec use it as an example but start with a clean vanilla one.
-Third, remove all crap that you don't need from HDAConfigDefaultlike the rest of codecs, keep only codec 283904133 and change it to283904136(alc888 or yours) with LayoutID 12, the first one, this willhelp you to keep things organized and clean/less mistakes.
This is what I don't know: #CodecAddressFilterArray and CodecAddressMask from it
And what I know:
#Codec Verbs what they are and how to make them
Ifyou look on plist you will see on "HDAConfigDefault" on "child/Item1 orItem0" (the only one if u make the clean) an entry "ConfigData" and abase64 encoded data on it.
After some chat with fassl he found a way to "read" that ConfigData, its not done but I'm posting it maybe other knows what we dont know...
Also Stickpin made some research, so here is what we "found" so far...:
Again I will use Taruga ALC888 Codec Adress 0 verb for example, if your codec is not adress 0 and its codec adress 2 just replace first bit 0 with 2:
Line1 NID 27 : Green Headphones/[Jack] HP Out at Ext Rear
Line2 NID 20 : Green Int speakers/[Fixed] Speaker at Int ATAPI
Line3 NID 26 : Black/[N/A] Speaker at Ext Rear
Line4 NID 21 : Black Headphones/[Jack] HP Out at Ext Rear
Line5 NID 31 : Mono Digital Black/[N/A] Speaker at Ext Rear
Line6 NID 30 : Mono Digital Unknown/[Fixed] SPDIF Out at Int ATAPI
Line7 NID 22 : Black/[N/A] Speaker at Ext Rear
Line8 NID 24 : Pink/[Jack] Mic at Ext Rear
Line9 NID 25 : Unknown/[Fixed] Mic at Int ATAPI
*UPDATE VERB is SOLVED!
Asyou can see the verb has 9 groups(can has more/less depending on codec)of 4 verbs(I split them just to show u on easy way), I will take firstone for example:
01b71c50 = CAd (Codec Adress)
01b71c50 = NID (Node id) --> In this case 1b hex->dec=27, in my case its Green Headphones/[Jack] HP Out at Ext Rear
01b71c50 = Verb Commands like 71"c" then "d", "e" ,"f"
01b71c50 = Verb Data
So what is Verb Data?
As you can see we have 4 sequencies on a pin verb:
01b71c50 01b71d70 01b71e21 01b71f01
01b71c505=Default Association 0=Sequence
01b71d707=Color 0=Misc
01b71e212=Default Device 1=Connection Type
01b71f010=Port Connectivity 1=Location
Port Connectivityindicates the external connectivity of the Pin Complex. Software canuse this value to know what Pin Complexes are connected to jacks,internal devices, or not connected at all.
00b - The Port Complex is connected to a jack (1/8", ATAPI, etc.).
01b - No physical connection for Port.
10b - A fixed function device (integrated speaker, integrated mic, etc.) is attached.
11b- Both a jack and an internal device are attached. The Informationprovided in all other fields refers to the integrated device. The PDpin will reflect the status of the jack; the user will need to bequeried to figure out what it is.
Location indicates thephysical location of the jack or device to which the pin complex isconnected. This allows software to indicate, for instance, that thedevice is the “Front Panel Headphone Jack” as opposed to rear panelconnections.
Default Device] indicates the intended useof the jack or device. This can indicate either the label on the jackor the device that is hardwired to the port, as with integratedspeakers and the like.
CODE
Line Out 0
Speaker 1
HP Out 2
CD 3
SPDIF Out 4
Digital Other Out 5
Modem Line Side 6
Modem Handset Side 7
Line In 8
AUX 9
Mic In A
Telephony B
SPDIF In C
Digital Other In D
Reserved E
Other F
Connection Typeindicates the type of physical connection, such as a 1/8-inch stereojack or an optical digital connector, etc. Software can use thisinformation to provide helpful user inte***ce descriptions to the useror to modify reported codec capabilities based on the capabilities ofthe physical transport external to the codec.
CODE
Unknown 0
1/8" stereo/mono 1
1/4" stereo/mono 2
ATAPI internal 3
RCA 4
Optical 5
Other Digital 6
Other Analog 7
Multichannel Analog (DIN) 8
XLR/Professional 9
RJ-11 (Modem) A
Combination B
Other F
Color indicates the color of the physical jack for use by software.
CODE
Unknown 0
Black 1
Grey 2
Blue 3
Green 4
Red 5
Orange 6
Yellow 7
Purple 8
Pink 9
Reserved A-D
White E
Other F
Miscis a bit field used to indicate other information about the jack.Currently, only bit 0 is defined. If bit 0 is set, it indicates thatthe jack has no presence detect capability, so even if a Pin Complexindicates that the codec hardware supports the presence detectfunctionality on the jack, the external circuitry is not capable ofsupporting the functionality.
Reserved 3
Reserved 2
Reserved 1
Jack Detect Override 0
Default Association and Sequenceare used together by software to group Pin Complexes (and thereforejacks) together into functional blocks to support multichanneloperation. Software may assume that all jacks with the same associationnumber are intended to be grouped together, for instance to provide sixchannel analog output. The Default Association can also be used bysoftware to prioritize resource allocation in constrained situations.Lower Default Association values would be higher in priority forresources such as processing nodes or Input and Output Converters. Notethat this is the default association only, and software can overridethis value if
required, in particular if the user providesadditional information about the particular system configuration. Avalue of 0000b is reserved and should not be used. Software mayinterpret this value to indicate that the Pin Configuration data hasnot been properly initialized. A value of 1111b is a special valueindicating that the Association has the lowest priority. Multipledifferent Pin Complexes may share this value, and each is intended tobe exposed as independent devices.
Sequence indicates theorder of the jacks in the association group. The lowest numbered jackin the association group should be assigned the lowest numberedchannels in the stream, etc. The numbers need not be sequential withinthe group, only the order matters. Sequence numbers within a set ofDefault Associations must be unique.
*My notes in n00b words for this, if you look on the vanilla codec verb(no matter what codec) you will see that Sequence is always 0.
Why that, and why for us on our codec verbs is different? *** b/c Apple dosen't have multichannel analog out! so you must change it to 0.
About Default Association,Try to setup your order for priority of use, for ex if you use mostinternal speakers on a notebook and HP as second priority put int spkas 1 and HP as 2 and so on, or for multichannel setup... the values youcan use are: 1, 2, 3, 4, 5, 6 and f. Port Connectivity and Location Port Connectivity Leave it as it is on dump/vista reg Location0 if its for internal atapi; 1 if its for external rear; 2 if its for external front
That's all, now you should know how to make a proper codec verb for use on OS X!
BTW if u get 3 LineOut and u need to set them as 5.1 take a look on Consolation GUIDE for how to set them!
MadTux found a way to dump codec verbs from vista registry, more detail on MadTux Patching HDA Topic, also Kabyladvice me on how to use linux codec dump to get that codec verb, Idouble check it with vista one, they are identical, also you can dumpyour codec using Taruga HDAudio.kext, for how to create codec verbs on OS X read below:
I will use for example my codec dump, remember that codec verbs are in hex format, so use original hex dump for what is next!
If you look on codec dump you will see that it starts with general info about codec, then the really good stuff, NODE ID also known in specific docs as NID
So to make codec verb on OS X you need to do this:
1. Make a copy of your original linux dump, WARNING! Don't use a codec dump that u get from internet or others, create one from your machine.
2. Rename it as Codec Verb, for easy catalog
3. Open it and delete all lines from it that dosen't contain in it "Node" and "Pin Default"
4. Make another cleaning and delete each line "Node 0Xyy" that dosent have under it line "Pin Default"
5. Now you should have only the NID with Pin Default under it.
6. I will take for example the first one from my dump(cleaned one):
Node 0x11 [Pin Complex] wcaps 0x400300: Mono Digital <--- this is not used but its just to show you how to
Pin Default 0x18561140: [Jack] Digital Out at Int HDMI <--- also remark bolded one on both line
7. Creating codec verbs using this ^^^ example:
take Node 0x11 transform it on 011 (when 0 is CAd and 11 is NID) then add first verb command 71c and add last 2 numbers from pindefault(40) result= 01171c40
take Node 0x11 transform it on 011 (when 0 is CAd and 11 is NID) then add second verb command 71d and from right to left next 2 numbers from pindefault(11) result= 01171d11
take Node 0x11 transform it on 011 (when 0 is CAd and 11 is NID) then add third verb command 71e and from right to left next 2 numbers from pindefault(56) result= 01171e56
take Node 0x11 transform it on 011 (when 0 is CAd and 11 is NID) then add four/last verb command 71f and from right to left remaining 2 numbers from pindefault(18) result= 01171f18
So the verb for NID 0x11 should look like this : 01171c40 01171d11 01171e56 01171e18,add a "<" in front and a space after it and u can go to the nextNID/create verb, when u finish add a ">" at the end, save it for thenext step described earlier(*** it OS X compatible), when u finishreplace existing data on "ConfigData" entry with the new one.
Layouts dunno... I leave them as they are...someone?
I'm not 100% sure but this is what I figured out:
-On entry widgets/item1/: MicAttributes:--> 28is ok dosen't have to change it, if you look on dump on NODE 28 it tellyo that is [N/A] SPEAKER AT EXT REAR and PIN-CTLS: 32: IN, correct meif I'm wrong, since I didn't fixed yet internal mic dunno for sure, Iwill try also with Node 29
MicInfo: --> Leave it as it is
NodeID: -->39 this must be changed to correct one, in my case Node 25 [FIXED] MIC AT INT ATAPI
PinConfigDefault: -->2426405136 this must be changed to correct one, in my case from the dump under Node 25 u have the right value: PIN DEFAULT 2577598815
That's all about AppleHDAPlatformDriver, for now...
6. Editing AppleHDAPlatformDriver Info.Plist
Do the same and remove all crap that you don't need from HDA Platform Resource:
-from Layouts, keep only that one with LayoutID: 12 and change the codec id with yours
-from PathMaps, keep only that one with PathMapID: 9
Now the major changes you have to made are on PathMaps:
Item1 setup LineIn *here I have to figure out how to add Internal Mic support
Item2 setup SpdifIn
Item3 Setup Internal Speakers/ExternalSpeakers(you will see 2 child on it)
Item4 setup LineOut
Item5 setup SpdifOut
Once you have the right pins it will be piece of cake to change the value on each Item/entry
NowI will cover Item3 to show you why there are 2 childs on it, the firstone is for internal speakers and the second is for HP Out. Why thereare on the same Item?
B/c of Jack autodetection, that mean when youplug ext speakers/headphones in, internal are muted and it willautomatically change to HP out.
Here is how should look:
There are also some terms that I dunno what they mean/does like: ProcessingState DetectDelegate RateCapsDelegate MuteGPIO MaximumBootBeepValue *dunno if we need this VREF
Please fill the missed info!
#Now for those who love boot 132 method, here is the tips on how to enable sound from /extra/extensions.mkext:
What you need:
-As CycloneFr described in His Topic (Thanks bro for helping me!) there is no need for snow kexts, just plist only one!
-Mode the plist as you do for normal Leopard kext(only Layouts and Pathmaps!)
-Put them with the rest of extensions you use on /extra
-Set correct permissions for them(chmod&chown)
-Create Extension.mkext with all!
-Put Extensions.mkext on /Extra/ *WARNINGDon't try to use just extensions it must be on Extensions.mkext alsoyou have to remove from /extra extensions folder if you use that before! Job is Done! No more hacked kext on /s/l/e, enjoy sound on install/first boot and also no more patching on updates!
Hereyou have the example for my notebook, no errors, 2 HP out, one on jackdetect with internal speakers, digital out and external mic in, onlyremaining one for now is internal mic, but I will fix it...---> ASUS M50SV Legacy Audio
Since I don't like default setup name for my notebook connections, Ichanged it a bit, so external mic became Line In, second HP Out becameLine Out and I added also HDMI Out in codec verb, it is not working yetb/c apple driver dosen't know yet what is HDMI Out, its just for futureupdates...
So here is my latest one: ASUS M50SV Legacy Audio HDMIOut CustomDONT DO THAT!
Latest status on my desktop: (AD1988b and ATI HD3870/ATI R6xxHDMIOut):
Soon AD1988b I got 5.1 analog out, volume ok, no mute, digitalin/out(can't test it since no digital in speakers) and no inputs(mic orline in), I have them on System Preferences but dosent work for now...
On HD3870 All things are done waiting for apple to add support for HDMIOut on hda...
*NEW
I finally figured out how to get internal mic working!
I'm too tired to explain what I did now, but I will edit later...
Until then here is my latest kext: M50SVALC888ST.kext
Here is Latest MacBook Pro 5,1 NID and Verbs:
CODE
MBP51 ALC885
Node 0x14 pin default 0x012b4050 - [Jack] HP Out at Ext Rear
VERBS 01471c50 01471d40 01471e2b 01471f01
Node 0x15 pin default 0x018b3020 - [Jack] Line In at Ext Rear
VERBS 01571c20 01571d30 01571e8b 01571f01
Node 0x16 pin default 0x400000f0 - [N/A] Line Out at Ext N/A
VERBS 01671cf0 01671d00 01671e00 01671f40
Node 0x17 pin default 0x400000f0 - [N/A] Line Out at Ext N/A
VERBS 01771cf0 01771d00 01771e00 01771f40
Node 0x18 pin default 0x90100140 - [Fixed] Speaker at Int N/A
VERBS 01871c40 01871d01 01871e10 01871f90
Node 0x19 pin default 0x90a00110 - [Fixed] Mic at Int N/A
VERBS 01971c10 01971d01 01971ea0 01971f90
Node 0x1a pin default 0x90100141 - [Fixed] Speaker at Int N/A
VERBS 01a71c41 01a71d01 01a71e10 01a71f90
Node 0x1b pin default 0x400000f0 - [N/A] Line Out at Ext N/A
VERBS 01b71cf0 01b71d00 01b71e00 01b71f40
Node 0x1c pin default 0x400000f0 - [N/A] Line Out at Ext N/A
VERBS 01c71cf0 01c71d00 01c71e00 01c71f40
Node 0x1d pin default 0x400000f0 - [N/A] Line Out at Ext N/A
VERBS 01d71cf0 01d71d00 01d71e00 01d71f40
Node 0x1e pin default 0x014be060 - [Jack] SPDIF Out at Ext Rear
VERBS 01e71c60 01e71de0 01e71e4b 01e71f01
Node 0x1f pin default 0x01cbe030 - [Jack] SPDIF In at Ext Rear
VERBS 01f71c30 01f71de0 01f71ecb 01f71f01
And my M50SV ALC888 S/T one:
CODE
M50SV ALC888
Node 0x11 pin default 0x18561140 - [Jack] Digital Out at Int HDMI
VERBS 01171c40 01171d11 01171e56 01171f18
Node 0x14 pin default 0x99130110 - [Fixed] Speaker at Int ATAPI
VERBS 01471c10 01471d01 01471e13 01471f99
Node 0x15 pin default 0x01211420 - [Jack] HP Out at Ext Rear
VERBS 01571c20 01571d14 01571e21 01571f01
Node 0x16 pin default 0x411111f0 - [N/A] Speaker at Ext Rear
VERBS 01671cf0 01671d11 01671e11 01671f41
Node 0x17 pin default 0x411111f0 - [N/A] Speaker at Ext Rear
VERBS 01771cf0 01771d11 01771e11 01771f41
Node 0x18 pin default 0x01a19850 - [Jack] Mic at Ext Rear
VERBS 01871c50 01871d98 01871ea1 01871f01
Node 0x19 pin default 0x99a3095f - [Fixed] Mic at Int ATAPI
VERBS 01971c5f 01971d09 01971ea3 01971f99
Node 0x1a pin default 0x411111f0 - [N/A] Speaker at Ext Rear
VERBS 01a71cf0 01a71d11 01a71e11 01a71f41
Node 0x1b pin default 0x0121441f - [Jack] HP Out at Ext Rear
VERBS 01b71c1f 01b71d44 01b71e21 01b71f01
Node 0x1c pin default 0x411111f0 - [N/A] Speaker at Ext Rear
VERBS 01c71cf0 01c71d11 01c71e11 01c71f41
Node 0x1d pin default 0x598301f0 - [N/A] Line In at Int ATAPI
VERBS 01d71cf0 01d71d01 01d71e83 01d71f59
Node 0x1e pin default 0x99430130 - [Fixed] SPDIF Out at Int ATAPI
VERBS 01e71c30 01e71d01 01e71e43 01e71f99
Node 0x1f pin default 0x411111f0 - [N/A] Speaker at Ext Rear
VERBS 01f71cf0 01f71d11 01f71e11 01f71f41
Compare them, look on my kext and you should figure out, based on this topic, what I did...
How to PinConfig, PinConfigDefault or PinConfigOverRides
U can obtain this PinConfig thru Vista registry explorer.
Click on:
START
RUN
and write: regedit (this will start registry explorer)
Search for PinConfig, and U will get something like this:
then you have to byte flip each double word; ---然后2位2位的倒着把数字重新排列(这个给家里小孩搞吧 呵呵 眼睛累^*^)
<01271CF0 01271D11 01271E11 01271F41 01371CF0 01371D11 01371E11 01371F41 01471C1F 01471D10 01471E21 01471F02 01571C10 01571D01 01571E13 01571F99 01671D11 01671CF0 01671F41 01671E11 01871D98 01871C40 01871F02 01871EA1 01971D09 01971C41 01971F99 01971EA3 01A71D30 01A71C4E 01A71F02 01A71E81 01C71D11 01C71CF0 01C71F41 01C71E11 01D71D95 01D71C2D 01D71F40 01D71E17 01E71D11 01E71C30 01E71F02 01E71E45>
然后就结束了 点下面链接行了 And after U done this go here so The King can tell U what to do with PinConfig: PinConfig How to; The King aka XyZ: