# How do I get analog out sound on headphone connector of 2006 Intel MacBook?



## cabriofahrer (May 3, 2022)

I have an old white 2006 Intel Macbook with FreeBSD 12.x installed on it. Unfortunately, apparently I only get SPDIF-out from the headphone connector, because it glows in red. Obviously, when I plug in a headphone, I have no sound.
I know that according to man snd_hda you can assign alternative configurations for sound, but I do not understand these instructions very well. So what configuration would I need in order to get analog sound out on the headphone connector?
I am providing the verbose dmesg output from that machine.


----------



## bsduck (May 4, 2022)

The relevant section:

```
hdaa0: Patched pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 10 0101e022 2  2  Line-out      Jack  1/8     Rear       White   0
hdaa0: 11 90afe112 1  2  Mic           Fixed Other   Internal   White   1
hdaa0: 12 9017e121 2  1  Speaker       Fixed Analog  Internal   White   1
hdaa0: 13 4180e100 0  0  Line-in       None  Unknown Rear       White   1 DISA
hdaa0: 14 41f0e032 3  2  Other         None  Unknown Rear       White   0 DISA
hdaa0: 15 0181e031 3  1  Line-in       Jack  1/8     Rear       White   0
hdaa0: 16 1145f023 2  3  SPDIF-out     Jack  Optical 0x11       Other   0
hdaa0: 17 11c5c032 3  2  SPDIF-in      Jack  Optical 0x11       Res.C   0
hdaa0: 21 4180e100 0  0  Line-in       None  Unknown Rear       White   1 DISA
hdaa0: 27 4180e100 0  0  Line-in       None  Unknown Rear       White   1 DISA
hdaa0: 3 associations found:
hdaa0: Association 0 (1) in:
hdaa0:  Pin nid=11 seq=2
hdaa0: Association 1 (2) out:
hdaa0:  Pin nid=12 seq=1
hdaa0:  Pin nid=10 seq=2
hdaa0:  Pin nid=16 seq=3
hdaa0: Association 2 (3) in:
hdaa0:  Pin nid=15 seq=1
hdaa0:  Pin nid=17 seq=2
```

You can try the following:

In /boot/device.hints add `hint.hdaa.0.nid10.config="as=2 seq=15"` (enables automatic switch to analog-out when you plug something in).

Reboot to apply changes.

If that doesn't work, add also `hint.hdaa.0.nid16.config="as=0"` (disables SPDIF-out).


----------



## cabriofahrer (May 5, 2022)

Thank you very much. Well, I tried both
`# kenv hint.hdaa.0.nid10.config="as=2 seq=15"` and `# kenv hint.hdaa.0.nid16.config="as=0"` which should do the trick without reboot, but it does not work.
I am beginning to think that something is also wrong with the connector itself, at it looks located like 5mm behind the white plastic case and not right outside as in other laptops or even PC mainboards or soundcards, so maybe a headphone or minijack cable does not make proper contact in the first place?


----------



## bsduck (May 5, 2022)

`kenv` doesn't seem to work for this, you need to reboot.

I tried to disable my output jack connector through `# kenv hint.hdaa.0.nid20.config="as=0"` and `# service mixer restart` but that didn't work, and the configuration reported by `sysctl dev.hdaa` didn't change accordingly.

Maybe if you have snd_hda.ko as a separate module you can try unloading and reloading it, but not sure if that will work and I can't try because as of 13.1-STABLE snd_hda has been merged into the GENERIC kernel. Just reboot to be sure.


----------



## cabriofahrer (May 6, 2022)

OK, reboot is indeed needed. But here is what happens:

with `hint.hdaa.0.nid10.config="as=2 seq=15"` and `hint.hdaa.0.nid16.config="as=0"` in /boot/device.hints there is no sound at all, not even from the built-in speakers and also no sound when plugging in the headphone either. The connector does not glow in red though.
With the second entry `hint.hdaa.0.nid16.config="as=0"` commented to disable it, the behaviour is as before without any entry:
Sound from the speaker, but no sound from the headphone when plugging it in and sound continues from the speaker.


----------



## hardworkingnewbie (May 10, 2022)

Well if nothing else helps: basic USB sound cards with headphone jack come around 10-15$. Just get one of those then instead.


----------



## cabriofahrer (Jun 11, 2022)

Maybe connecting an ordinary mini-jack connector does not work on a macbook at all? As I have no knowledge at all about Apple products, maybe this article says it all? Can someone please confirm?






						What is the difference between the Apple speaker minijack and the headphone jack on the Power Mac G4? How do you connect a microphone to the Power Mac G4? Modem?: EveryMac.com
					

Explains Apple speaker minijack compatibility, Power Mac G4 USB microphone usage, Power Mac G4 modem type, and more.




					everymac.com


----------



## getopt (Jun 11, 2022)

As having said there:



getopt said:


> The worm in Apple is the "genetic defect" of wanted incompatibility. It's their "DNA" and that never will get a repair.


Hardware compatibility is always a problem with Apple products. They want to force their customers to buy even the earphones and other accessories from their brand.

While I'm of course without the knowledge if that is the case here (Apple is abandonware here  ) I nevertheless suggest to check and confirm the specs of the connector. All vendors provide pdf-manuals on the specs of their products. Apple users just have to look this up more often than customers of other vendors that stay with the industry standards.


----------



## hardworkingnewbie (Jun 11, 2022)

cabriofahrer said:


> Maybe connecting an ordinary mini-jack connector does not work on a macbook at all? As I have no knowledge at all about Apple products, maybe this article says it all? Can someone please confirm?
> 
> 
> 
> ...


The Power Mac G4 was modern 18 years ago.


----------



## quakerdoomer (Nov 19, 2022)

bsduck said:


> `kenv` doesn't seem to work for this, you need to reboot.
> 
> I tried to disable my output jack connector through `# kenv hint.hdaa.0.nid20.config="as=0"` and `# service mixer restart` but that didn't work, and the configuration reported by `sysctl dev.hdaa` didn't change accordingly.
> 
> Maybe if you have snd_hda.ko as a separate module you can try unloading and reloading it, but not sure if that will work and I can't try because as of 13.1-STABLE snd_hda has been merged into the GENERIC kernel. Just reboot to be sure.


How does one use oss in that case? Is recompilation of the kernel without snd_hda the only option?
Autoconfig has failed to detect my mic - I intend to use oss which shows my mic but says I need to disable the inbuilt audio. Any suggestions?


----------



## cabriofahrer (Nov 19, 2022)

quakerdoomer said:


> How does one use oss in that case? Is recompilation of the kernel without snd_hda the only option?
> Autoconfig has failed to detect my mic - I intend to use oss which shows my mic but says I need to disable the inbuilt audio. Any suggestions?


I am not an expert in this matter at all myself. I am not sure if I understand you right, do you want to use oss from the ports and disable the one from the kernel? Or are you asking how to use hints? Apparently, it looks like the `kenv` command has no effect, so you need to put your hint line in /boot/device.hints and reboot. This should work, provided your hints line is correct.
As for using oss from the ports, all I can say that if you do a `pkg install oss`, you get the following message:


```
Message from oss-4.2.b2019_2:

--
This port uses installation procedure that is very different from
the one used by 4Front and is not supported by them.  All bug reports
should go to the port maintainer via the usual PR mechanism.

To load OSS at boot, add oss_enable="YES" to your /etc/rc.conf.

It is necessary to ensure that your kernel does not have sound.ko
compiled in, which is always the case for GENERIC.  Please refer to
the Handbook for advice on this.
```

I have not had a look at the Handbook, so I don't know if recompiling the kernel is necessary or maybe a line in a config file instructing not to load that module is enough.


----------



## quakerdoomer (Nov 20, 2022)

I am ready to use any method that works. I am thinking about trying oss since it detected and played music and shows me a microphone device under /dev but cannot use it yet. I will be downloading source and I will have to comment everything under #Sound, correct? I mean everything that starts with snd_ and recompile, correct?

I still do not understand what does as=1 and as=15 and seq= mean. I will be just blindly trying all nids and configs one by one and will reboot if I cannot use oss on my new kernel. Honestly I do not get the overconfidence of the person who decided to make snd_hda a part of the kernel by default for everyone when clearly most people are having some issues or the other with sound.


----------



## cabriofahrer (Nov 21, 2022)

I have never recompiled a kernel, so I cannot help you there.


quakerdoomer said:


> I still do not understand what does as=1 and as=15 and seq= mean. I will be just blindly trying all nids and configs one by one


It is explained in "man snd_hda". The thing is that this matter is not easy to understand. Also, you first need to obtain a verbose output of `dmesg`, I think. And for that you need the entry `debug.bootverbose=1` in /etc/sysctl.conf.
You then have to interpret the relevant section of "hdaa0" (see commment #2 in this thread) according to the explanations given in "man snd_hda".
Sorry I really don't much more.


----------



## quakerdoomer (Nov 21, 2022)

Journey continued here: https://forums.freebsd.org/threads/need-a-simple-command-method-for-boot-hints.87149/post-588514


----------



## shepper (Nov 22, 2022)

Most laptop utilize intel hda based sound chips which have many, many pins (nid).  Not all pins are typically used and may be connected differently.  For example Apple may utilize pin 19 for the front panel audio jack while Dell may use pin 20.

If you are lucky, someone has already worked out sound configuration for your laptop.  Search this forum and the web for your laptop model and FreeBSD.  If you do not get any hits, read on.

FreeBSD organizes the pins by location.  On a desktop, the back jacks may be organized into group 0, the front panel into group 1, onboard speakers into group 2 hdmi sound on the video card group 3 ..etc.

By default only one group is used in FreeBSD.  The handbook tells you how to change the group on the first page in the multimedia section.

This Thread 57969 shows a more complex configuration where the front panel headphone is put into the same group (associated) with the laptop's onboard speakers.  It provides all the commands to see what you are actually dealing with.

snd_hda(1) is dense reading but it provides the details.


----------

