Jump to content

[How To] Pinconfig for Linux users � Realtek ALC883 example


  • Please log in to reply
32 replies to this topic

#1
Master Chief

Master Chief

    Just Chief

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,176 posts
  • Gender:Male
Educational Tutorial

First, before anyone goes bonkers, I personally have nothing against Microsoft neither Windows, but what if you simply don't have Windows Vista? And I'm not going to download a torrent or get it otherwise. No thanks.

And what if you don't want to install Windows again and happen to have a Linux codec dump? Well, here's what I did to get my Leopard 10.5.6 installation going on an ASUS P5K-PRO motherboard � it should still work with 10.5.7 and Snow Leopard (10.6.0).

Work in progress - last edit:
7 June 2009 � fixed a typo (1 > 0) and gram error (thanks for spotting it guys).
11 June 2009 � removed spurious spaces inserted by Full edit (making a mess of it).
12 June 2009 � cleanups and adding some additional some of the info wasn't clear enough.
14 June 2009 � CodecDump compared with Ubuntu 9.04 (8.10 and are exactly the same).

15 June 2009 � New Pin Default Cheat Sheet in the make!!!
17 June 2009 � New findings about vanilla audio posted here.
17 June 2009 � PinConfiguration and ConfigData fixed (no more "None" for the Microphone) thanks to tmongkol
19 June 2009 � Adding links and text to "Patching com.apple.Boot.plist"


Introduction
Let me start by saying that this tutorial is (far) from complete, but I'm a very busy person (Mozilla Application Developer) and thus all this has to be done in spare time so yeah... it'll take me some time to finish it. The good news is that this old geezer is writing a new article about audio stuff on the hackintosh, and thus we might get there one day soon.

Spotting errors or a broken link: PM me and I'll fix it. Thanks!

What this is not: Please note that this is not a freeway to audio heaven. And no I am not going to fix your audio kexts. It's all up to you... or you'll have to find someone else to do it for you. I simply won't have the time for it since I'm also a father of four children... go figure. Hey, I am already writing this tutorial, remember?

The first thing you need is either a Windows or Linux codec dump. And you can generate it on Linux with:
cat /proc/asound/card0/codec#0 > ~/Desktop/codecname_codec_dump.txt
Note: You might need to: cd /proc/asound/card0/ and look for the right codex#

I personally used my Ubuntu 8.10 installation, which was the latest official release at the time of this writing, to create the attached alc883_codec_dump.hex. I later compared the codec dump with Ubuntu 9.04 and they are exactly.

Don't have Linux, yet? Simply get the Ubuntu LiveCD here (instructions included), but you might as well try one of the other Linux distributions.

The next thing you want to do is, that is if you didn't already, is to install XCode IDE � a must have developer tool. And no you don't have to become a developer, but Xcode comes with a few great tools like: Property List Editor and IORegistry Explorer. And yes it is a free download � though you need to sign-up to get it (no worries). Probably just a way for Apple to say: "We have 10 million developers world wide". Right. Just because people need Xcode IDE and thus have to become a registered developer. Whatever.

Codec Dumps Part I � A First Glance
Let's get started. First download the attached codec (scroll down to Files) and open it with something like TextEdit or whatever tools you prefer to use. We'll be using this codec throughout this tutorial, as an example, but you should first compare it with your own codec (look for similarities). Now let's have a look at the codec here, starting with the following lines:

Codec: Realtek ALC883
Address: 0
Vendor Id: 0x10ec0883
Subsystem Id: 0x1043829f

The most important parts here are highlighted in red � the green one shows up in System Profiler (most prominently) and is constructed from the subsystem-vendor-id (1043) and subsystem-id (829f) which you can find with Apple's IORegistry Explorer (part of Apple's Xcode IDE) or simply by entering the following command in a terminal window:

sudo ioreg -l (lowercase L) > ~/Desktop/ioreg-out.txt

Codec Dumps Part II � What Exactly Are We Looking For?
So what exactly are we looking for? Good question. The first value we need is the Address aka CAd (CodecAddress) which in this case is: 0 (zero). It might not be 0 but for example 1 or 2. And you'll be using this value in the following paragraphs so yeah, it is pretty important. The second value is... well the Vendor ID, which in this case is: 0x10ec0883 or 283904131 decimal � we'll have to use decimal values in our plist files.

Let's get to the first snippet, and in the attached alc883_codec_dump.hex this looks like this:

Node 0x14 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
Amp-In vals: [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals: [0x00 0x00]
Pincap 0x083e: IN OUT HP Detect Trigger
Pin Default 0x01014010: [Jack] Line Out at Ext Rear
Conn = 1/8, Color = Green
DefAssociation = 0x1, Sequence = 0x0
Pin-ctls: 0x40: OUT
Unsolicited: tag=00, enabled=0
Connection: 5
0x0c* 0x0d 0x0e 0x0f 0x26


Again, the most important parts here are highlighted in red � the green lines will be discussed in a later stage. The data we're after (for now) is: Node 0x14 being the NID (Node ID) and the Pin Default 0x01014010.

The Pin Default (a 32-bit register in the Pin Complex Widget) is used by software as an aid in determining the configuration of jacks and devices attached to the codec. At the time the codec is first powered on, this register is internally loaded with default values indicating the typical system use of this particular pin/jack

We also need to keep an eye on the Sequence, simply because it can only be 0 on real Mac's. Let's start by looking at the following Pin Default: 0x76543210 � just a simple example to identify all digits.

Where:
0 = Sequence
1 = Default Association
2 = Miscellaneous
3 = Color
4 = Connection Type
5 = Default Device
6 = Location
7 = Port Connectivity

Note the right-to-left or host-byte-order, which might look strange at first for non-developers, but that's how it works. Follow the jump to the Intel HDA specification for a complete description (starting at page 149) which I tell you is a must read.


Codec Dumps Part III � Constructing Verbs
Let's construct our first "Verb Layout" with help of the following *cough* formula *cough*:

CAd + NID + 71X + Masked Pin Default � where X is either: c, d, e, or f.

Like this:

0 + 14 + 71c + 10
0 + 14 + 71d + 40
0 + 14 + 71e + 01
0 + 14 + 71f + 01

Note: the 71x part in this group is the Verb ID which is used by the software to identify verbs. We skip 710 thru 71a in this example aka the GPIO (General Purpose Input/Output) control bytes, which are discussed in great detail in the Intel HDA specification. And there's no word about 71b in the Intel HDA specifications so we'll simply ignore it here.

Which gives us:
01471c10  01471d40  01471e01  01471f01

Now repeat this procedure for all other snippets containing: Node and Pin Default. Let's take the second snippet from my alc883_codec_dump.hex to make sure you understand it � most unnecessary parts have been removed in the following snippet:

Node 0x15 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pincap 0x083e: IN OUT HP Detect Trigger
Pin Default 0x01011012: [Jack] Line Out at Ext Rear
Conn = 1/8, Color = Black
DefAssociation = 0x1, Sequence = 0x2

Like this:
0 + 15 + 71c + 12
0 + 15 + 71d + 10
0 + 15 + 71e + 01
0 + 15 + 71f + 01

Giving us: 01571c12 01571d10 01571e01 01571f01

Codec Dumps Part IV � Fixing Sequence Errors
The above value for Sequence can only be 0 on a Mac and thus we simply need to change it, or things won't work properly. And here's the patched group:
01571c10 01571d10  01571e01  01571f01
Note: The c,d,e, and f are used by the software to identify the verb!

Codec Dumps Part V � Finishing Up
Let's do the rest, but this time even more information ls removed, and that is why we start with the following color table from the Intel HDA Specifications (Table 105):

Where:
0 = Unknown
1 = Black
2 = Grey
3 = Blue
4 = Green
5 = Red
6 = Orange
7 = Yellow
8 = Purple
9 = Pink
E = White
F = Other



Node 0x16 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pin Default 0x01016011: [Jack] Line Out at Ext Rear

01671c10 01671d60 01671e01 01671f01

Note: 1 is invalid and has been changed to 0!

Node 0x17 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pin Default 0x01012014: [Jack] Line Out at Ext Rear

01771c10 01771d20 01771e01 01771f01

Note: 4 is invalid and has been changed to 0!

Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pin Default 0x01a19840: [Jack] Mic at Ext Rear

01871c40 01871d98 01871ea1 01871f01

Node 0x19 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pin Default 0x02a19c50: [Jack] Mic at Ext Front

01971c50 01971d9c 01971ea1 01971f02

Node 0x1a [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pin Default 0x0181304f: [Jack] Line In at Ext Rear

01a71c40 01a71d30 01a71e81 01a71f01

Note: f is invalid and has been changed to 0!

Node 0x1b [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
Pin Default 0x02214c20: [Jack] HP Out at Ext Front

01b71c20 01b71d4c 01b71e21 01b71f02

Node 0x1c [Pin Complex] wcaps 0x400001: Stereo
Pin Default 0x593301f0: [N/A] CD at Int ATAPI

01c71cf0 01c71d01 01c71e33 01c71f59

Node 0x1d [Pin Complex] wcaps 0x400000: Mono
Pin Default 0x4015e601: [N/A] Speaker at Ext N/A

01d71c00 01d71de6 01d71e15 01d71f40

Note: 1 is invalid and has been changed to 0!

Node 0x1e [Pin Complex] wcaps 0x400300: Mono Digital
Pin Default 0x01441130: [Jack] SPDIF Out at Ext Rear

01e71c30 01e71d11 01e71e44 01e71f01

Node 0x1f [Pin Complex] wcaps 0x400200: Mono Digital
Pin Default 0x411111f0: [N/A] Speaker at Ext Rear

01f71cf0 01f71d11 01f71e11 01f71f41


ConfigData
Putting the whole bunch together gives us the ConfigData we need for Info.plist � com.apple.Boot.plist and dsdt.dsl modifications are also discussed, but later on:
"<" +
		01471c10	01471d40	01471e01	01471f01
		01571c10	01571d10	01571e01	01571f01
		01671c10	01671d60	01671e01	01671f01
		01771c10	01771d20	01771e01	01771f01
		01871c40	01871d98	01871ea1	01871f90
		01971c50	01971d9c	01971ea1	01971f02
		01a71c40	01a71d30	01a71e81	01a71f01
		01b71c20	01b71d4c	01b71e21	01b71f02
		01c71cf0	01c71d01	01c71e33	01c71f59
		01d71c00	01d71de6	01d71e15	01d71f40
		01e71c30	01e71d11	01e71e44	01e71f01
		01f71cf0	01f71d11	01f71e11	01f71f41
  + ">"
And this is how it should look (no tabs, no weird spaces or other illegal characters):

<01471c10 01471d40 01471e01 01471f01 01571c10 01571d10 01571e01 01571f01 01671c10 01671d60 01671e01 01671f01 01771c10 01771d20 01771e01 01771f01 01871c40 01871d98 01871ea1 01871f90 01971c50 01971d9c 01971ea1 01971f02 01a71c40 01a71d30 01a71e81 01a71f01 01b71c20 01b71d4c 01b71e21 01b71f02 01c71cf0 01c71d01 01c71e33 01c71f59 01d71c00 01d71de6 01d71e15 01d71f40 01e71c30 01e71d11 01e71e44 01e71f01 01f71cf0 01f71d11 01f71e11 01f71f41>


Converting NodeID's
The next step is to convert the hexadecimal NID's (NodeID's) to decimal values (plist files work with decimal values). You can use the OS X Calculator (select Menu View -> Programmer) to convert them, or use this script - written by Munky (yah). Whichever you pick, I've done my work and added both the hexadecimal and decimal values (where possible) like this: 0xnn/n
Line 01:  NID 0x14/20  [Jack] Line Out at Ext Rear - Front Speaker Out (Green)
Line 02:  NID 0x15/21  [Jack] Line Out at Ext Rear - Rear Speaker Out (Black)
Line 03:  NID 0x16/22  [Jack] Line Out at Ext Rear - Center/ Subwoofer (Orange)
Line 04:  NID 0x17/23  [Jack] Line Out at Ext Rear - Side Speaker  (Grey)
Line 05:  NID 0x18/24  [Jack] Mic at Ext Rear  (Pink)
Line 06:  NID 0x19/25  [Jack] Mic at Ext Front  (Pink)
Line 07:  NID 0x1a/26  [Jack] Line In at Ext Rear  (Blue)
Line 08:  NID 0x1b/27  [Jack] HP Out at Ext Front  (Green)
Line 09:  NID 0x1c/28  [N/A] CD at Int ATAPI
Line 10:  NID 0x1d/29  [N/A] Speaker at Ext N/A  (White)
Line 11:  NID 0x1e/30  [Jack] SPDIF Out at Ext Rear  (Black)
Line 12:  NID 0x1f/31  [N/A] Speaker at Ext Rear  (Black)
The (colors) were added by me, and your NID's are probably different (BTW; the color of the SPDIF out RCA adapter on the Asus P5K-PRO isn't really black, but yellow).


Our First Result
Here's what I've got so far in System Profiler/Audio(builtin). Please note that the green in and output devices became visual after I added the above ConfigData to AppleHDAController's Info.plist:

Intel High Definition Audio:
Device ID: 0x1043829F
Audio ID: 12
Available Devices:
Line Out:
Connection: 1/8 inch Jack
Microphone:
Connection: 1/8 inch Jack
Microphone:
Connection: 1/8 inch Jack
Headphone:
Connection: 1/8 inch Jack
S/P-DIF Out:
Connection: RCA


The above Device ID (in red) should match your codec's Subsystem Id and the Audio ID (also in red) represents the used layout-id. Please note that there are two kind of data sets, of which one make System Profiler show the info, and another to make your sound actually work and show up under Output and Input in System Preferences (sound).

Please keep in mind that having something in System Profiler, under Audio (Built-in) doesn't necessarily mean that your sound will actually work, but merely that it can find something to show!

Note: There's more work to be done, because it doesn't really match with the hardware (P5K-PRO). It is however a start, and used as an example only here.

Installing Software
The next thing you might need to do is to install Codecgraph and Graphviz. This to generate a graphical presentation (Scalable Vector Graphics) of your codec.

Please note that you don't necessarily need to do this, at least not when your codec dump is listed under the "Known codecs" section of the first link. But here's a little how for us Linux users:

./codecgraph  alc883_codec_dump.hex
You might want to scroll down to Files and have a look at the attached SVG files. Open it with Mozilla Firefox (Safari failed to show both scrollbars) but first unpack it (it's a ZIP file) � other examples can be found by following the first link in this paragraph.

Note: Continue reading "The next step - making connections" when you already have a codec dump!


Making connections
We are about to collect the data we need to add/or modify in our Info.plist
files. But more about plist files later. For now; let's have another look at the nodes in alc883_codec_dump.hex, starting with Node 0x14/20. I'll remove everything but the lines we're interested in:

Connection: 5
0x0c* 0x0d 0x0e 0x0f 0x26

This tells us that there are five (5) connections, of which the one marked with the asterisk (*) is the most interesting - the one we're looking for. That's the Audio Mixer (gray hexagon in the SVG file) we're looking for. Let's have a look at the connections of Node 0x0c/12:

Connection: 2
0x02 0x0b

No asterisk this time. No, we're gonna have to figure that out ourself, which is pretty easy because we know what kind of connection we're working on - being our output device. And looking at Node 0x02/2. Yep, that's the one we're looking for. That's our Audio Output (blue ellipse in the SVG file). This is the first one:

NID [0x14/20] Jack - Line Out at Ext Rear - Front Speaker Out (Green) <0x0c/12> (0x02/2)

Note the used colors and characters - this to make it easier to read/understand:

[green] = Pin Complex
<gray> = Audio Mixer
(red) = input node
(blue) = output node
where 0xnn/n = hexadecimal value / decimal value (Info.plist wants decimal values)

Now, let's do another one. Node 0x15/21 this time. Again, I'll remove everything but the interesting lines:

Connection: 5
0x0c 0x0d* 0x0e 0x0f 0x26

Again, we're after the one with the asterisk and that'll be 0x0d/13 in this case. That's the Audio Mixer we're looking for. And here's the connection list:

Connection: 2
0x03 0x0b

Right, 0x03/3 is another Audio Output so we take that. Done. That was the second one. Here's the outcome:

NID [0x15/21] Jack - Line Out at Ext Rear - Rear Speaker Out (Black) <0x0d/13> (0x03/3)

Read this: Analog output devices can be tracked from the source, being the Pin Complex to their corresponding Audio Mixer. Digital devices however don't need the latter and thus these are a little less complex to setup. Input devices are a different kind of beast, because you need to follow the opposite direction, being from the connector towards the corresponding Audio Mixer and Pin Complex.

Let's try to figure out the connections for Node 0x18/24. Here's the connections list:

Connection: 5
0x0c* 0x0d 0x0e 0x0f 0x26

Which is pretty useless now since we've already used/setup 0x0c/12 Remember? Dead end. Back to the codec dump. There you'll find the two Audio Input nodes being 0x08/8 and 0x09/9 (red ellipses in the SVG file). That's what we need. Check the connection lists to find 0x23/34 and 0x24/35 which are the two Audio Mixers we're looking for. Both have connections to either Audio Mixer so just pick one. Leading to the following input devices:

NID [0x18/24] Jack - Mic at Ext Rear (Pink) <0x22/34> (0x09/9)
NID [0x19/25] Jack - Mic at Ext Front (Pink) <0x22/34> (0x09/9)
NID [0x1a/26] Jack - Line In at Ext Rear (Blue) <0x23/35> (0x08/8)


Putting it together
Let's start with kext files. Which are just folders with data and/or sub-directories in it. Nothing magic; though they might look a bit strange at first.

Kext files usually reside in /System/Library/Extensions/ but you might as well use /Extra for your legacy (modified plist only) kext files. In fact that way things are less messy, and OS upgrades are less likely to break your installation.

It also depends on the installed version of OS X, and how you want to fix your audio (when needed) because injecting data with legacy kexts is not the same thing as injecting data from your modified dsdt.dsl (dsdt.aml) or using device properties in com.apple.Boot.plist The effect should all be the same, of course... giving you audio, but copying a few available legacy kexts is probably the first thing you'll want to do.

Please note that you still might need one or more legacy kexts when you use the DSDT injection method because in the end it all depends on the used hardware, and if that is somewhat compatible with real available/supported Apple hardware.

Note: DSDT hacking is not the holy grail and is probably a bit too difficult for many people (no offense) so only take this route when you know what you are doing!

Now back to hacking. Have a look at /System/Library/Extensions/AppleHDA.kext and the files in it. The most importantly two are just property files:
AppleHDA.kext/Contents/PlugIns/AppleHDAController.kext/Contents/Info.plist
AppleHDA.kext/Contents/PlugIns/AppleHDAPlatformDriver.kext/Contents/Info.plist

You'll want to use either Property List Editor, which comes with Apple's Xcode IDE (developer tools) or just: sudo nano <path to file>Info.plist � using the latter will probably be a daunting task at first, but it will be fine when you got used to it.


PinConfigurations
People who inject data with a modified dsdt.dsl or com.apple.Boot.plist (device properties often referred to as EFI-Strings) also need the PinConfigurations, which we get by taking the last two digits from the ConfigData (scroll up):

10 40 01 01 10 10 01 01 11 60 01 01 10 20 01 01 40 98 a1 90 50 9c a1 02 40 30 81 
01 20 4c 21 02 f0 01 33 59 00 e6 15 40 30 11 44 01 f0 11 11 41


Patching dsdt.dsl
The corresponding PinConfigurations snipped for dsdt.dsl hackers looks like:
"PinConfigurations",
  Buffer (0x30)
  {
	  /* 0000 */	0x10, 0x40, 0x01, 0x01, 0x10, 0x10, 0x01, 0x01,
	  /* 0008 */	0x11, 0x60, 0x01, 0x01, 0x10, 0x20, 0x01, 0x01,
	  /* 0010 */	0x40, 0x98, 0xa1, 0x90, 0x50, 0x9c, 0xa1, 0x02,
	  /* 0018 */	0x40, 0x30, 0x81, 0x01, 0x20, 0x4c, 0x21, 0x02,
	  /* 0020 */	0xf0, 0x01, 0x33, 0x59, 0x00, 0xe6, 0x15, 0x40,
	  /* 0028 */	0x30, 0x11, 0x44, 0x01, 0xf0, 0x11, 0x11, 0x41
  }
Note: The value 0x30 (hex) represents the buffer length!
Giving us:
Device (HDEF){	Name (_ADR, 0x001B0000)	Method (_PRW, 0, NotSerialized)	{		Return (Package (0x02)		{			0x0D, 			0x05		})	}					Method (_DSM, 4, NotSerialized)	{	    Store (Package (0x06)	    {		"built-in",		Buffer (One)		{			0x00		},				   		"layout-id",		Buffer (0x04)		{			0x0c, 0x00, 0x00, 0x00		},			  		"PinConfigurations",		Buffer (0x30)		{			/* 0000 */	0x10, 0x40, 0x01, 0x01, 0x10, 0x10, 0x01, 0x01, 			/* 0008 */	0x11, 0x60, 0x01, 0x01, 0x10, 0x20, 0x01, 0x01, 			/* 0010 */	0x40, 0x98, 0xa1, 0x90, 0x50, 0x9c, 0xa1, 0x02, 			/* 0018 */	0x40, 0x30, 0x81, 0x01, 0x20, 0x4c, 0x21, 0x02, 			/* 0020 */	0xf0, 0x01, 0x33, 0x59, 0x00, 0xe6, 0x15, 0x40, 			/* 0028 */	0x30, 0x11, 0x44, 0x01, 0xf0, 0x11, 0x11, 0x41		}	   }, Local0)	DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))	Return (Local0)       }}

Note: The value 0x06 represents the number of items you've put in the package, and needs to be increased when you add items in this scope!


Patching com.apple.Boot.plist
You'll find com.apple.Boot.plist in /Library/Preferences/SystemConfiguration/ and the corresponding PinConfigurations snippet for com.apple.Boot.plist hackers will be something like this:
<key>PciRoot(0x0)/Pci(0x1b,0x0)</key>
	<dict>
		<key>built-in</key>
		 <string>0x00</string>
		 <key>PinConfigurations</key>
	   <data>EEABARAQAQERYAEBECABAUCYoZBQnKECQDCBASBMIQLwATNZAOYVQDARRAHwERFB</data>
		<key>layout-id</key>
		<string>0x0000000c</string>
	</dict>

The first thing you probably noticed is that weird string of character between the <data> tags. Well, that's a base64 representation of the PinConfigurations. And that is why people here advise you to use a plist editor � because that will encode it for you in the used Info.plist.

People who know how things work can, of course, use one of the many on-line base64 converters or save their data in a hex file, with say HexEdit, and encode the PinConfigurations with help of OpenSSL like this:
openssl base64 -e -in ~/Desktop/PinConfigurations.hex

It might still look like magic now, but you can easily verify your own findings with help of the graphical presentation of your codec dump - the SVG file because they should match. You need these connections, or there won't be sound, or on the wrong port. Link being at the wrong airport... err no flight. Sorry.

I hope you've learned enough new stuff to keep you busy (for now). Just open the attached codec dump, or better your own, and give it a go. Next time we'll discuss the steps to add/modify the Info.plist files. That'll be fun. I promise.

Thank you
I would like to thank TheKing for his information (for now just follow this link for additional info) about the sequence value, which always should be 0 (as in zero), my buddy at Intel Tom, macgirl for doing Perl scripting. Thanks folks!


Background Information
I noticed that some of the information we need for System Profiler is right in front of us:
Conn = 1/8, Color = Green
DefAssociation = 0x1, Sequence = 0x0
I figured that the Intel HDA specification would be a great help so I did a Google search and got the information I was looking for. You might want to print the pages 151 and 152, as I did (by far the most interesting pages for starters).

Software and Tools
Property List Editor � part of XCode
PlistEdit Pro

Files - used in this tutorial

Attached Files



#2
macgirl

macgirl

    Stargate's Pharaoh

  • Retired
  • 7,612 posts
  • Gender:Female
  • Location:Mexico City
  • Interests:Techie gadgets
I made 2 perl scripts that runs with TextWrangler (little brother of BBEdit) to convert from Pin config to "human readable" format:

so this:
<01471c10 01471d40 01471e01 01471f01>

is converted to this:
0 14 71c 1 0  node 20 association 1 sequence 0
0 14 71d 4 0  node 20 Green Jack Detect Override
0 14 71e 0 1  node 20 Line Out 1/8" stereo
0 14 71f 0 1  node 20 port 0 Location 1
and another script that once you made changes (on the left part) coud give you the altered pin config.

Here they are if anyone want to use it, they go in the Unix Filters Folder of the TextWrangler.
Attached File  AppleHDA_pinconfig_scripts.zip   1.74KB   325 downloads

#3
kidalive

kidalive

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 274 posts
  • Gender:Male
[quote name='Master Chief' date='Jan 26 2009, 01:53 AM' post='1055645']
HOW ABOUT MY CASE Master Chief? I got ALC 883 Address 1 still not working. Can you help?
Here is the my card info.

#4
Manish Singh

Manish Singh

    InsanelyMac Protégé

  • Members
  • Pip
  • 8 posts
Master Chief. Thank you very very much for such a wonderful and easy to understand guide. I will be desperately waiting for information on editing the AppleHDA info.plist. I can't seem to figure out the connection part yet and how should I put the NodeIDs in the pathmaps. Your codec graph is remarkably different and complicated than mine so, I am kinda lost. I am still working on it though.

Keep up the good work.

Cheers :)
Manish

#5
ninu1984

ninu1984

    InsanelyMac Protégé

  • Members
  • Pip
  • 6 posts
hi all, I'm trying to do that but i don't understand one things.

I don't understand the reason for changing some numbers for 0, but in other cases you don't change.

I'd be glad if you could expose this to the comunity

Thanks a lot :angel:

#6
Trauma!

Trauma!

    Took too much...

  • Members
  • PipPipPipPipPipPipPip
  • 964 posts
  • Gender:Male
  • Location:France

hi all, I'm trying to do that but i don't understand one things.

I don't understand the reason for changing some numbers for 0, but in other cases you don't change.

I'd be glad if you could expose this to the comunity

Thanks a lot :(


The value he is changing is called the "sequence", in linux's Dump you can find various value at this place !
So if sequence values are different from : 0 or 1 or f Osx wont recognize it and the verb is ignored for this node.

In Vista's dump you'll never see sequence values different from : 0 or 1 or f
It's appear to be the same in real Mac' dump under Linux !

@ macgirl : very nice script, very andy ! But i cant get it to work :) !! I always get the same errors :

Attached File  Errors.jpg   14.67KB   60 downloads

A little help will be nice ^_^

Bye

#7
sammaz

sammaz

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts
I just dumped my codec and it is identical to yours!!!

good news for me!

check it out...can you email me your appleHDA.kext and enabler?

I have been trying for months!

Thanks!

Attached Files



#8
sammaz

sammaz

    InsanelyMac Protégé

  • Members
  • Pip
  • 11 posts

I just dumped my codec and it is identical to yours!!!

good news for me!

check it out...can you email me your appleHDA.kext and enabler?

I have been trying for months!

Thanks!



I used these guys work and everything is working!!!

http://www.insanelym...p;#entry1071506

Thanks to the French???!!! ;)

#9
macgirl

macgirl

    Stargate's Pharaoh

  • Retired
  • 7,612 posts
  • Gender:Female
  • Location:Mexico City
  • Interests:Techie gadgets

@ macgirl : very nice script, very andy ! But i cant get it to work :wacko: !! I always get the same errors :

Attached File  Errors.jpg   14.67KB   60 downloads

A little help will be nice ;)

Bye

How you are using them?

Did you check those lines?
Attached File  Picture_1.png   112.21KB   394 downloads

#10
holyfield

holyfield

    InsanelyMac Protégé

  • Members
  • PipPip
  • 93 posts
  • Gender:Male
  • Location:Europe
Thank you!

I'm having trouble to getting work my ALC883 on ICH7

Codec: Realtek ALC883
	 Address: 0
	 Vendor Id: 0x10ec0883
	 Subsystem Id: 0x147b107d
	 Revision Id: 0x100002
	 No Modem Function Group found
	 Default PCM:
		 rates [0x560]: 44100 48000 96000 192000
		 bits [0xe]: 16 20 24
		 formats [0x1]: PCM
I have made dumps and graphs of ALC883 codec. So I use now your guide to folly the rest of procedure.

I hope i get it to work on 10.5.6 iDeneb v1.4

#11
winktinkler

winktinkler

    InsanelyMac Protégé

  • Members
  • Pip
  • 42 posts
Master Chief

Thanks for this guide and detailed .... Please see question below near bottom of this reply / question?





The next step - Instaling software:
Now it is time to install Codecgraph and Graphviz to generate a graphical presentation (Scalable Vector Graphics) of your codec. Note that you don't necessarily need to install the software, at least not when your codec dump is listed under the "Known codecs" section of the first link. Here's the command to generate the SVG file (alc883_codec_dump.svg in my case):

./codecgraph  alc883_codec_dump.hex

Want to see an example? Just get mine (see attachments at the bottom) and open it with Mozilla Firefox (Safari failed to show both scrollbars) after you've unpacked it (more codec dumps can be found by following the this link).
The next step - making connections:
Now we're going to collect the numbers we need to add/modify in our plist files. More about plist files later. Have another look at the nodes in alc883_codec_dump.hex, starting with Node 0x14/20. I'll remove everything but the lines we're interested in:

Connection: 5
0x0c* 0x0d 0x0e 0x0f 0x26

This tells us that there are five (5) connections, of which the one marked with the asterisk (*) is the most interesting - the one we're looking for. That's the Audio Mixer (gray hexagon in the SVG file) we're looking for. Let's have a look at the connections of Node 0x0c/12:

Connection: 2
0x02 0x0b

No asterisk this time. No, we're gonna have to figure that out ourself, which is pretty easy because we know what kind of connection we're working on - being our output device. And looking at Node 0x02/2. Yep, that's the one we're looking for. That's our Audio Output (blue ellipse in the SVG file). This is the first one:

NID [0x14/20] Jack - Line Out at Ext Rear - Front Speaker Out (Green) <0x0c/12> (0x02/2)

Note the used colors and characters - this to make it easier to read/understand:

[green] = Pin Complex
<gray> = Audio Mixer
(red) = input node
(blue) = output node
where 0xnn/n = hexadecimal value / decimal value (Info.plist wants decimal values)

Now, let's do another one. Node 0x15/21 this time. Again, I'll remove everything but the interesting lines:

Connection: 5
0x0c 0x0d* 0x0e 0x0f 0x26

Again, we're after the one with the asterisk and that'll be 0x0d/13 in this case. That's the Audio Mixer we're looking for. And here's the connection list:

Connection: 2
0x03 0x0b

Right, 0x03/3 is another Audio Output so we take that. Done. That was the second one. Here's the outcome:

NID [0x15/21] Jack - Line Out at Ext Rear - Rear Speaker Out (Black) <0x0d/13> (0x03/3)

Read this: Analog output devices can be tracked from the source, being the Pin Complex to their corresponding Audio Mixer. Digital devices however don't need the latter and thus these are a little less complex to setup. Input devices are a different kind of beast, because you need to follow the opposite direction, being from the connector towards the corresponding Audio Mixer and Pin Complex.

Let's try to figure out the connections for Node 0x18/24. Here's the connections list:

Connection: 5
0x0c* 0x0d 0x0e 0x0f 0x26

Which is pretty useless now since we've already used/setup 0x0c/12 Remember? Dead end. Back to the codec dump. There you'll find the two Audio Input nodes being 0x08/8 and 0x09/9 (red ellipses in the SVG file). That's what we need. Check the connection lists to find 0x23/34 and 0x24/35 which are the two Audio Mixers we're looking for. Both have connections to either Audio Mixer so just pick one. Leading to the following input devices:

NID [0x18/24] Jack - Mic at Ext Rear (Pink) <0x22/34> (0x09/9)
NID [0x19/25] Jack - Mic at Ext Front (Pink) <0x22/34> (0x09/9)
NID [0x1a/26] Jack - Line In at Ext Rear (Blue) <0x23/35> (0x08/8)





I have gone thru the steps here, have all of the required dumps, edited, created the list with the Node Id's, etc. and generated the graph

I am in the process of 'connecting' the Node Id's to the addresses for the ports verfied in the graph .. as in your
NID List ....


This is kind of stupid, how do I use the information on the NID ...... list .... Where do I enter that (which plist file .... ???

AppleHDAController info.plist

or HDEnabler info.plist


Lost .... and groggy ...

Thanks for the work and this guide ...

.....
















It might still look like magic now, but you can easily verify your own findings with help of the graphical presentation of your codec dump - the SVG file because they should match. You need these connections, or there won't be sound, or on the wrong port. Link being at the wrong airport... err no flight. Sorry.

I hope you've learned enough new stuff to keep you busy (for now). Just open the attached codec dump, or better your own, and give it a go. Next time we'll discuss the steps to add/modify the Info.plist files. That'll be fun. I promise.

#12
Trauma!

Trauma!

    Took too much...

  • Members
  • PipPipPipPipPipPipPip
  • 964 posts
  • Gender:Male
  • Location:France

How you are using them?

Did you check those lines?
Attached File  Picture_1.png   112.21KB   394 downloads


All right, so i have to place it in the filters folder !! Not in the script folder.... :)

Here they are if anyone want to use it, they go in the Unix Script Folder of the TextWrangler.


Thank you very much, it's a nice tool !!

Bye.

#13
macgirl

macgirl

    Stargate's Pharaoh

  • Retired
  • 7,612 posts
  • Gender:Female
  • Location:Mexico City
  • Interests:Techie gadgets
Sorry for the mis-directions.

I don't know what differences are between those :)

#14
holyfield

holyfield

    InsanelyMac Protégé

  • Members
  • PipPip
  • 93 posts
  • Gender:Male
  • Location:Europe

01a71c40 01a71d30 01a71e81 01a71f01

Note: f is invalid and has been changed to 0!


Please can you describe why f is invalid? How you know it? And how I should figure out what is wrong value on my codec dump?

I made for same audio codec dumps with different linux distros and I got different dumps. ON I made with Ubuntu 8.04 and second with Mandriva 2009 KDE4

#15
undo_undo

undo_undo

    InsanelyMac Protégé

  • Members
  • Pip
  • 40 posts

"<" +

01471c10 01471d40 01471e01 01471f01
01571c10 01571d10 01571e01 01571f01
01671c1101671d60 01671e01 01671f01
01771c10 01771d20 01771e01 01771f01
01871c40 01871d98 01871ea1 01871f01
01971c50 01971d9c 01971ea1 01971f02
01a71c40 01a71d30 01a71e81 01a71f01
01b71c20 01b71d4c 01b71e21 01b71f02
01c71cf0 01c71d01 01c71e33 01c71f59
01d71c00 01d71de6 01d71e15 01d71f40
01e71c30 01e71d11 01e71e44 01e71f01
01f71cf0 01f71d11 01f71e11 01f71f41

+ ">"


Hi Master Chief,

I have questions:

Q1) why is the sequence for 01671c11 is 1, not 0?

Q2) if I have Pinconfig from Vista, do I still need linux dump? if so, for what reason?

Q3) In your Info.plist of AppleHDA.kext\Contents\AppleHDAController.kext, I see
<key>ConfigData</key>
<data>AUccEAFHHUABRx4BAUcfAQFXHBABVx0QAVceAQFXHwEBZxwRAWcdYAFnHgEBZx8BAXccEAF3HSABd
4BAXcfAQGHHEABhx2YAYceoQGHHwEBlxxQAZcdnAGXHqEBlx8CAaccQAGnHTABpx6BAacfAQG3HCABtx
MAbceIQG3HwIBxxzwAccdAQHHHjMBxx9ZAdccAAHXHeYB1x4VAdcfQAHnHDAB5x0RAeceRAHnHwEB9xz
AfcdEQH3HhEB9x9B</data>

Isn't Data for ConfigData should be more like 01471c10 01471d40 01471e01 01471f01 .. from your codec verb?

Thanks.

#16
fellz

fellz

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 1 posts
Yep i noticed the same why for all lines it's 0 and for 3 is 1 at the end. Is that mistake ?

#17
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts
I believe it is just a typo. It should be 0 (zero) because it should comply with this rule (quote from THe KiNG How To):-

*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? Simple b/c Apple dosen't have multichannel analog out! so you must change it to 0.

@holyfield, just use the latest live cd. If the two live cd is the latest, you can experiment with both dump & finally choose one that nearly 100% working.

@undo_undo, you need Plist editor like PlistEdit Pro to edit plist file especially when you're going to edit "Data":-
<key>ConfigData</key>
<data>AUccEAFHHUABRx4BAUcfAQFXHBABVx0QAVceAQFXHwEBZxwRAWcdYAFnHgEBZx8BAXccEAF3HSAB

4BAXcfAQGHHEABhx2YAYceoQGHHwEBlxxQAZcdnAGXHqEBlx8CAaccQAGnHTABpx6BAacfAQG3HCABtx
MAbceIQG3HwIBxxzwAccdAQHHHjMBxx9ZAdccAAHXHeYB1x4VAdcfQAHnHDAB5x0RAeceRAHnHwEB9xz
AfcdEQH3HhEB9x9B</data>
If you going to use PlistEdit Pro, remove "<" & ">" before paste it in ConfigData. You only require to include it if you're using "Property List Editor" program.

<01471c10 01471d40 01471e01 01471f01 01571c10 01571d10 01571e01 01571f01 01671c10 01671d60 01671e01 01671f01 01771c10 01771d20 01771e01 01771f01 01871c40 01871d98 01871ea1 01871f01 01971c50 01971d9c 01971ea1 01971f02 01a71c40 01a71d30 01a71e81 01a71f01 01b71c20 01b71d4c 01b71e21 01b71f02 01c71cf0 01c71d01 01c71e33 01c71f59 01d71c00 01d71de6 01d71e15 01d71f40 01e71c30 01e71d11 01e71e44 01e71f01 01f71cf0 01f71d11 01f71e11 01f71f41>


kizwan

#18
Riley Freeman

Riley Freeman

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 879 posts
  • Gender:Male
  • Location:The Streets
I'm trying to get a CMI9880 running using this guide. I got through the first bit fine and added the vendor id and config data to the info.plist in AppleHDAController.

But I'm lost at the Converting Node IDs step. What am I supposed to do with the decimal values and where are they to go? I can breeze over the graph generation as the CMI9880 is in the codec database.

This is what I'm working with (taken from the codec dump):
Line 01: NID 0x0b/11 [Jack] Line Out at Ext Rear
   Verb:	10B71C10 10B71D41 10B71E01 10B71F01
   
   Line 02: NID 0x0c/12 [Jack] Aux at Ext Front
   Verb:	10C71C00 10C71D31 10C71E91 10C71F02
   
   Line 03: NID 0x0d/13 [Jack] Mic at Ext Rear
   Verb:	10D71C00 10D71D91 10D71EA1 10D71F01 
   
   Line 04: NID 0x0e/14 [Jack] Line Out at Ext Rear
   Verb:	10E71C10 10E71D21 10E71E01 10E71F01
   
   Line 05: NID 0x0f/15 [Jack] HP Out at Ext Front
   Verb:	10F71C00 10F71D41 10F71E21 10F71F02 
   
   Line 06: NID 0x10/16 [Jack] Mic at Ext Front
   Verb:	11071C00 11071D91 11071EA1 11071F02 
   
   Line 07: NID 0x11/17 [Jack] CD at Ext UNKNOWN
   Verb:	11171C00 11171D00 11171E33 11171F09 
   
   Line 08: NID 0x12/18 [Jack] SPDIF Out at Ext Rear
   Verb:	11271C00 11271D00 11271E44 11271F01 
   
   Line 09: NID 0x13/19 [Jack] SPDIF In at Ext Rear
   Verb:	11371C00 11371D00 11371EC4 11371F01 
   
   Line 10: NID 0x1f/31 [Jack] Line Out at Ext Rear
   Verb:	11F71C10 11F71D61 11F71E01 11F71F01
   
   Line 11: NID 0x20/32 [Jack] Line Out at Ext Rear
   Verb:	12071C10 12071D11 12071E01 12071F01
   
 -----------------------------------------------
 
   Node 0x0b	Connection: 1	0x03
   Node 0x0c	Connection: 1	0x04
   Node 0x0d	Connection: 1	0x05
   Node 0x0e	Connection: 1	0x06
   Node 0x0f	Connection: 4	0x03* 0x04 0x05 0x06
   Node 0x10	Connection: 4	0x03* 0x04 0x05 0x06
   Node 0x11	Conn = ATAPI, Color = Unknown  Pin-ctls: 0x00:
   Node 0x12	Connection: 1	0x07
   Node 0x13	Conn = RCA, Color = Unknown  Pin-ctls: 0x00:
   Node 0x1f	Connection: 4	0x03 0x04* 0x05 0x06
   Node 0x20	Connection: 4	0x03 0x04 0x05* 0x06


#19
Riley Freeman

Riley Freeman

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 879 posts
  • Gender:Male
  • Location:The Streets
Well I'm making a little progress. I think I have the AppleHDAController.kext set up ok. It seems most of the remaining action is in the HDAPlatformDriver kext. From what I can gather I pick out a LayoutID and corresponding Pathmap and edit the values there to match my nodes. Trouble is, I haven't the faintest idea where to even start. Too much conflicting info spread across too many threads.

I'm sure it's a snip once you get one codec done. But until you can get all the way through it's plain rocket science.

#20
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts

Well I'm making a little progress. I think I have the AppleHDAController.kext set up ok. It seems most of the remaining action is in the HDAPlatformDriver kext. From what I can gather I pick out a LayoutID and corresponding Pathmap and edit the values there to match my nodes. Trouble is, I haven't the faintest idea where to even start. Too much conflicting info spread across too many threads.

I'm sure it's a snip once you get one codec done. But until you can get all the way through it's plain rocket science.


Looks like you successfully construct your codec verbs. You have to concentrate on two threads, where first you need to read the THe KiNG How To (you can find the link at the first post) & second is this thread. You will understand more when you read both how to. In the AppleHDAPlatformDriver, start with pathmaps first.

Good luck. :thumbsup_anim:

kizwan





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy